﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using SystemModule;

namespace M2Server
{
    public class ConditionFunction : ScriptBase
    {
        private delegate void TNpcCondition(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result);
        /// <summary>
        /// 脚本条件检查列表
        /// </summary>
        private Dictionary<int, TNpcCondition> NpcCondition;

        public void InitNpcCondition()
        {
            NpcCondition = new Dictionary<int, TNpcCondition>();
            NpcCondition[M2Share.nCHECK] = ConditionOfCheck;
            NpcCondition[M2Share.nRANDOM] = ConditionOfRandom;
            NpcCondition[M2Share.nGENDER] = ConditionOfGender;
            NpcCondition[M2Share.nDAYTIME] = ConditionOfDayTime;
            NpcCondition[M2Share.nCHECKLEVEL] = ConditionOfCheckLevel;
            NpcCondition[M2Share.nCHECKJOB] = ConditionOfCheckJob;
            NpcCondition[M2Share.nCHECKITEM] = ConditionOfCheckItem;
            NpcCondition[M2Share.nCHECKGOLD] = ConditionOfCheckGold;
            NpcCondition[M2Share.nCHECKDURA] = ConditionOfCheckDura;
            NpcCondition[M2Share.nDAYOFWEEK] = ConditionOfDayOfWeek;
            NpcCondition[M2Share.nHOUR] = ConditionOfHour;
            NpcCondition[M2Share.nMIN] = ConditionOfMin;
            NpcCondition[M2Share.nCHECKPKPOINT] = ConditionOfCheckPKPoint;
            NpcCondition[M2Share.nCHECKMONMAP] = ConditionOfCheckMonMapCount;
            NpcCondition[M2Share.nCHECKHUM] = ConditionOfCheckHum;
            NpcCondition[M2Share.nCHECKBAGGAGE] = ConditionOfCheckBagGage;
            NpcCondition[M2Share.nCHECKNAMELIST] = ConditionOfCheckNameList;
            NpcCondition[M2Share.nCHECKACCOUNTLIST] = ConditionOfCheckAccountList;
            NpcCondition[M2Share.nCHECKIPLIST] = ConditionOfCheckIPList;
            NpcCondition[M2Share.nEQUAL] = ConditionOfEqual;
            NpcCondition[M2Share.nLARGE] = ConditionOfLapge;
            NpcCondition[M2Share.nSMALL] = ConditionOfSmall;
            NpcCondition[M2Share.nSC_ISSYSOP] = ConditionOfISSYSOP;
            NpcCondition[M2Share.nSC_ISADMIN] = ConditionOfISAdmin;
            NpcCondition[M2Share.nSC_CHECKGROUPCOUNT] = ConditionOfCheckGroupCount;
            NpcCondition[M2Share.nSC_CHECKPOSEDIR] = ConditionOfCheckPoseDir;
            NpcCondition[M2Share.nSC_CHECKPOSELEVEL] = ConditionOfCheckPoseLevel;
            NpcCondition[M2Share.nSC_CHECKPOSEGENDER] = ConditionOfCheckPoseGender;
            NpcCondition[M2Share.nSC_CHECKLEVELEX] = ConditionOfCheckLevelEx;
            NpcCondition[M2Share.nSC_CHECKBONUSPOINT] = ConditionOfCheckBonusPoint;
            NpcCondition[M2Share.nSC_CHECKMARRY] = ConditionOfCheckMarry;
            NpcCondition[M2Share.nSC_CHECKPOSEMARRY] = ConditionOfCheckPoseMarry;
            NpcCondition[M2Share.nSC_CHECKMARRYCOUNT] = ConditionOfCheckMarryCount;
            NpcCondition[M2Share.nSC_CHECKMASTER] = ConditionOfCheckMaster;
            NpcCondition[M2Share.nSC_HAVEMASTER] = ConditionOfHaveMaster;
            NpcCondition[M2Share.nSC_CHECKPOSEMASTER] = ConditionOfCheckPoseMaster;
            NpcCondition[M2Share.nSC_POSEHAVEMASTER] = ConditionOfPoseHaveMaster;
            NpcCondition[M2Share.nSC_CHECKISMASTER] = ConditionOfCheckIsMaster;
            NpcCondition[M2Share.nSC_HASGUILD] = ConditionOfCheckHaveGuild;
            NpcCondition[M2Share.nSC_ISGUILDMASTER] = ConditionOfCheckIsGuildMaster;
            NpcCondition[M2Share.nSC_ISCASTLEGUILD] = ConditionOfCheckIsCastleaGuild;
            NpcCondition[M2Share.nSC_ISATTACKGUILD] = ConditionOfCheckIsAttackGuild;
            NpcCondition[M2Share.nSC_ISDEFENSEGUILD] = ConditionOfCheckIsDefenseGuild;
            NpcCondition[M2Share.nSC_CHECKCASTLEDOOR] = ConditionOfCheckCastleDoorStatus;
            NpcCondition[M2Share.nSC_ISATTACKALLYGUILD] = ConditionOfCheckIsAttackAllyGuild;
            NpcCondition[M2Share.nSC_ISDEFENSEALLYGUILD] = ConditionOfCheckIsDefenseAllyGuild;
            NpcCondition[M2Share.nSC_CHECKPOSEISMASTER] = ConditionOfCheckPoseIsMaster;
            NpcCondition[M2Share.nSC_CHECKNAMEIPLIST] = ConditionOfCheckNameIPList;
            NpcCondition[M2Share.nSC_CHECKACCOUNTIPLIST] = ConditionOfCheckAccountIPList;
            NpcCondition[M2Share.nSC_CHECKSLAVECOUNT] = ConditionOfCheckSlaveCount;
            NpcCondition[M2Share.nSC_ISNEWHUMAN] = ConditionOfISNewHuman;
            NpcCondition[M2Share.nSC_CHECKMEMBERTYPE] = ConditionOfCheckMemberType;
            NpcCondition[M2Share.nSC_CHECKMEMBERLEVEL] = ConditionOfCheckMemBerLevel;
            NpcCondition[M2Share.nSC_CHECKGAMEPOINT] = ConditionOfCheckGamePoint;
            NpcCondition[M2Share.nSC_CHECKNAMELISTPOSITION] = ConditionOfCheckNameListPostion;
            NpcCondition[M2Share.nSC_CHECKGUILDLIST] = ConditionOfCheckGuildList;
            NpcCondition[M2Share.nSC_CHECKRENEWLEVEL] = ConditionOfCheckReNewLevel;
            NpcCondition[M2Share.nSC_CHECKSLAVELEVEL] = ConditionOfCheckSlaveLevel;
            NpcCondition[M2Share.nSC_CHECKSLAVENAME] = ConditionOfCheckSlaveName;
            NpcCondition[M2Share.nSC_CHECKCREDITPOINT] = ConditionOfCheckCreditPoint;
            NpcCondition[M2Share.nSC_CHECKOFGUILD] = ConditionOfCheckOfGuild;
            NpcCondition[M2Share.nSC_CHECKUSEITEM] = ConditionOfCheckUseItem;
            NpcCondition[M2Share.nSC_CHECKBAGSIZE] = ConditionOfCheckBagSize;
            NpcCondition[M2Share.nSC_CHECKDC] = ConditionOfCheckDC;
            NpcCondition[M2Share.nSC_CHECKMC] = ConditionOfCheckMC;
            NpcCondition[M2Share.nSC_CHECKSC] = ConditionOfCheckSC;
            NpcCondition[M2Share.nSC_CHECKHP] = ConditionOfCheckHP;
            NpcCondition[M2Share.nSC_CHECKMP] = ConditionOfCheckMP;
            //FNpcCondition[M2Share.nSC_CHECKITEMTYPE] = ConditionOfCheckItemType;
            NpcCondition[M2Share.nSC_CHECKEXP] = ConditionOfCheckExp;
            NpcCondition[M2Share.nSC_CHECKCASTLEGOLD] = ConditionOfCheckCastleGold;
            NpcCondition[M2Share.nSC_CHECKBUILDPOINT] = ConditionOfCheckGuildBuildPoint;
            NpcCondition[M2Share.nSC_CHECKAURAEPOINT] = ConditionOfCheckGuildAuraePoint;
            NpcCondition[M2Share.nSC_CHECKSTABILITYPOINT] = ConditionOfCheckStabilityPoint;
            NpcCondition[M2Share.nSC_CHECKFLOURISHPOINT] = ConditionOfCheckFlourishPoint;
            NpcCondition[M2Share.nSC_CHECKCONTRIBUTION] = ConditionOfCheckContribution;
            NpcCondition[M2Share.nSC_CHECKRANGEMONCOUNT] = ConditionOfCheckRangeMonCount;
            NpcCondition[M2Share.nSC_CHECKITEMADDVALUE] = ConditionOfCheckItemAddValue;
            NpcCondition[M2Share.nSC_CHECKINMAPRANGE] = ConditionOfCheckInMapRange;
            NpcCondition[M2Share.nSC_CASTLECHANGEDAY] = ConditionOfCheckCastleChageDay;
            NpcCondition[M2Share.nSC_CASTLEWARDAY] = ConditionOfCheckCastleWarDay;
            NpcCondition[M2Share.nSC_ONLINELONGMIN] = ConditionOfCheckOnlineLongMin;
            NpcCondition[M2Share.nSC_CHECKGUILDCHIEFITEMCOUNT] = ConditionOfCheckChiefItemCount;
            NpcCondition[M2Share.nSC_CHECKNAMEDATELIST] = ConditionOfCheckNameDateList;
            NpcCondition[M2Share.nSC_CHECKUSERDATE] = ConditionOfCheckNameDateList;
            NpcCondition[M2Share.nSC_CHECKMAPHUMANCOUNT] = ConditionOfCheckMapHumanCount;
            NpcCondition[M2Share.nSC_CHECKMAPMONCOUNT] = ConditionOfCheckMapMonCount;
            NpcCondition[M2Share.nSC_CHECKVAR] = ConditionOfCheckVar;
            NpcCondition[M2Share.nSC_CHECKSERVERNAME] = ConditionOfCheckServerName;
            NpcCondition[M2Share.nCHECKMAPNAME] = ConditionOfCheckMapName;
            NpcCondition[M2Share.nINSAFEZONE] = ConditionOfCheckSafeZone;
            NpcCondition[M2Share.nCHECKSKILL] = ConditionOfCheckSkill;
            NpcCondition[M2Share.nSC_CHECKCONTAINSTEXT] = ConditionOfAnsiContainsText;
            NpcCondition[M2Share.nSC_COMPARETEXT] = ConditionOfCompareText;
            NpcCondition[M2Share.nSC_CHECKTEXTLIST] = ConditionOfCheckTextList;
            NpcCondition[M2Share.nSC_ISGROUPMASTER] = ConditionOfIsGroupMaster;
            NpcCondition[M2Share.nSC_CHECKCONTAINSTEXTLIST] = ConditionOfCheCkContAinsTextList;
            NpcCondition[M2Share.nSC_CHECKONLINE] = ConditionOfCheckOnLine;
            NpcCondition[M2Share.nSC_ISDUPMODE] = ConditionOfIsDupMode;
            NpcCondition[M2Share.nSC_ISONMAP] = ConditionOfIosnMap;
            NpcCondition[M2Share.nSC_ISLOCKPASSWORD] = ConditionOfLockPassword;
            NpcCondition[M2Share.nSC_ISLOCKSTORAGE] = ConditionOfIsLockStorage;
            NpcCondition[M2Share.nSC_CHECKGAMEGLORY] = ConditionOfCheckGameGlory;
            NpcCondition[M2Share.nSC_CHECKGAMEGIRD] = ConditionOfCheckGameGird;
            NpcCondition[M2Share.nSC_CHECKSIDESLAVENAME] = ConditionOfChecksideslaveName;
            NpcCondition[M2Share.nSC_CHECKMAPMOBCOUNT] = ConditionOfCheckMapMobCount;
            NpcCondition[M2Share.nSC_CHECKSKILLLEVEL] = ConditionOfCheckSkillLevel;
            NpcCondition[M2Share.nSC_CHECKGAMEDIAMOND] = ConditionOfCheckGameDiaMond;
            NpcCondition[M2Share.nSC_CHECKSTRINGLENGTH] = ConditionOfCheckStringlength;
            NpcCondition[M2Share.nSC_CHECKCASTLEMASTER] = ConditionOfCheckIsCastleMaster;
            NpcCondition[M2Share.nSC_CHECKSTATIONTIME] = ConditionOfCheckStationTime;
            NpcCondition[M2Share.nSC_PASSWORDERRORCOUNT] = ConditionOfCheckPasswordErrorCount;
            NpcCondition[M2Share.nSC_CHECKITEMTYPE] = ConditionOfCheckItemType;
            NpcCondition[M2Share.nSC_CHECKGAMEGOLD] = ConditionOfCheckGameGold;
            NpcCondition[M2Share.nSC_CHECKKILLPLAYSEX] = ConditionOfCheckPlaySex;
            NpcCondition[M2Share.nSC_CHECKPLAYDIESEX] = ConditionOfCheckPlaySex;
            NpcCondition[M2Share.nSC_CHECKPLAYDIEJOB] = ConditionOfCheckPlayJob;
            NpcCondition[M2Share.nSC_CHECKKILLPLAYJOB] = ConditionOfCheckPlayJob;
            NpcCondition[M2Share.nSC_CHECKPLAYDIELVL] = ConditionOfCheckPlaylvl;
            NpcCondition[M2Share.nSC_CHECKKILLPLAYLVL] = ConditionOfCheckPlaylvl;
            NpcCondition[M2Share.nSC_CHECKONLINE] = ConditionOfCheckPlayIsOnline;
            NpcCondition[M2Share.nSC_CHECKHUMINRANGE] = ConditionOfCheckHumInRange;
            NpcCondition[M2Share.nSC_CHECKHEROLEVEL] = ConditionOfCheckHeroLevel;
            NpcCondition[M2Share.nSC_CHECKONLINEPLAYCOUNT] = ConditionOfCheckOnlinePlayCount;
            NpcCondition[M2Share.nSC_CHECKITEMLEVEL] = ConditionOfCheckItemLevel;
            NpcCondition[M2Share.nSC_CHECKMAKEWINE] = ConditionOfCheckMakeWine;
            NpcCondition[M2Share.nSC_CHECKMINE] = ConditionOfCheckMine;
            NpcCondition[M2Share.nCHECKITEMSTATE] = ConditionOfCheckItemState;
            NpcCondition[M2Share.nSC_CHECKHEROJOB] = ConditionOfCheckHeroJob;
            NpcCondition[M2Share.nSC_CHECKCURRENTDATE] = ConditionOfCHECKCURRENTDATE;
            NpcCondition[M2Share.nSC_CHECKMASTERONLINE] = ConditionOfCHECKMASTERONLINE;
            NpcCondition[M2Share.nSC_CHECKDEARONLINE] = ConditionOfCHECKDEARONLINE;
            NpcCondition[M2Share.nSC_CHECKMASTERONMAP] = ConditionOfCHECKMASTERONMAP;
            NpcCondition[M2Share.nSC_CHECKDEARONMAP] = ConditionOfCHECKDEARONMAP;
            NpcCondition[M2Share.nSC_CHECKPOSEISPRENTICE] = ConditionOfCHECKPOSEISPRENTICE;
            NpcCondition[M2Share.nSC_CHECKCASTLEWAR] = ConditionOfCHECKCASTLEWAR;
            NpcCondition[M2Share.nSC_FINDMAPPATH] = ConditionOfFINDMAPPATH;
            NpcCondition[M2Share.nSC_CHECKHEROLOYAL] = ConditionOfCHECKHEROLOYAL;
            NpcCondition[M2Share.nISONMAKEWINE] = ConditionOfISONMAKEWINE;
            NpcCondition[M2Share.nCHECKGUILDFOUNTAIN] = ConditionOfCHECKGUILDFOUNTAIN;
            NpcCondition[M2Share.nSC_MAPHUMISSAMEGUILD] = ConditionOfMAPHUMISSAMEGUILD;
            NpcCondition[M2Share.nHEROCHECKSKILL] = ConditionOfHEROCHECKSKILL;
            NpcCondition[M2Share.nSC_HAVEHERO] = ConditionOfCheckHasHero;
            NpcCondition[M2Share.nSC_CHECKHEROONLINE] = ConditionOfCheckHeroOnline;
            NpcCondition[M2Share.nSC_CHECKHEROPKPOINT] = ConditionOfCHECKHEROPKPOINT;
            NpcCondition[M2Share.nSC_CHECKCODELIST] = ConditionOfCHECKCODELIST;
            NpcCondition[M2Share.nCHECKITEMSNAME] = ConditionOfCHECKITEMSNAME;
            NpcCondition[M2Share.nCHECKGUILDMEMBERCOUNT] = ConditionOfCHECKGUILDMEMBERCOUNT;
            NpcCondition[M2Share.nCHECKGUILDFOUNTAINVALUE] = ConditionOfCHECKGUILDFOUNTAINValue;
            NpcCondition[M2Share.nCHECKNGLEVEL] = ConditionOfCHECKNGLEVEL;
            NpcCondition[M2Share.nISHIGH] = ConditionOfISHIGH;
            NpcCondition[M2Share.nSC_CHANGREADNG] = ConditionOfCHANGREADNG;
            NpcCondition[M2Share.nSC_CHECKNAMEIPLIST] = ConditionOfCheckNameIPList;
        }

        public bool CheckCmd(int cmdCode)
        {
            if (NpcCondition.ContainsKey(cmdCode))
            {
                return true;
            }
            return false;
        }

        public void Invoke(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo,
            ref bool Result)
        {
            NpcCondition[QuestConditionInfo.nCMDCode](NormNpc, PlayObject, QuestConditionInfo, ref Result);
        }

        private void ConditionOfCheckPlayIsOnline(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo,
            ref bool Result)
        {
            string s01 = QuestConditionInfo.sParam1;
            if ((s01 != "") && (s01[0] == '<') && (s01[1] == '$'))
            {
                s01 = GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam1);
            }
            else
            {
                GetValValue(PlayObject, QuestConditionInfo.sParam1, ref s01);
            }
            if ((s01 == "") || (M2Share.UserEngine.GetPlayObject(s01) == null))
            {
                Result = false;
            }
        }

        /// <summary>
        /// 检查当前行会是否属于沙巴克
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <returns></returns>
        private void ConditionOfCheckIsCastleaGuild(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo,
            ref bool Result)
        {
            Result = false;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                if (M2Share.g_CastleManager.IsCastleMember(PlayObject) != null)
                {
                    Result = true;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckIsCastleaGuild");
            }
        }

        private void ConditionOfCheckIsCastleMaster(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo,
            ref bool Result)
        {
            Result = false;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                if (PlayObject.IsGuildMaster() && (M2Share.g_CastleManager.IsCastleMember(PlayObject) != null))
                {
                    Result = true;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckIsCastleMaster");
            }
        }

        /// <summary>
        /// 功能：检查字符串的长度
        /// 格式：CheckStringlength 字符串 操作符(<,>,=) 位数
        /// </summary>
        private void ConditionOfCheckStringlength(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo,
            ref bool Result)
        {
            Result = false;
            char cMethod;
            int nLength;
            string sMag;
            if (QuestConditionInfo.sParam6 == "88")
            {
                PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                if (PlayObject == null)
                {
                    return;
                }
            }
            try
            {
                nLength = HUtil32.Str_ToInt(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam3), -1);// 位数
                sMag = GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam1);// 字符串
                if ((nLength < 0) || (sMag == ""))
                {
                    Result = false;
                    // ScriptConditionError(NormNpc, PlayObject, QuestConditionInfo, sSC_CheckStringlength);
                    return;
                }
                cMethod = QuestConditionInfo.sParam2[1];
                switch (cMethod)
                {
                    case '=':
                        if (sMag.Length == nLength)
                        {
                            Result = true;
                        }
                        break;
                    case '>':
                        if (sMag.Length > nLength)
                        {
                            Result = true;
                        }
                        break;
                    case '<':
                        if (sMag.Length < nLength)
                        {
                            Result = true;
                        }
                        break;
                    default:
                        if (sMag.Length >= nLength)
                        {
                            Result = true;
                        }
                        break;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckStringlength");
            }
        }

        private void ConditionOfCheckGameDiaMond(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo,
            ref bool Result)
        {
            Result = false;
            char cMethod;
            int nGameDiaMond;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                nGameDiaMond = HUtil32.Str_ToInt(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam2), -1);
                if (nGameDiaMond < 0)
                {
                    if (!GetValValue(PlayObject, QuestConditionInfo.sParam2, ref nGameDiaMond))
                    {
                        ScriptConditionError(NormNpc, PlayObject, QuestConditionInfo, M2Share.sSC_CHECKGAMEDIAMOND);
                        return;
                    }
                }
                cMethod = QuestConditionInfo.sParam1[0];
                switch (cMethod)
                {
                    case '=':
                        if (PlayObject.m_nGAMEDIAMOND == nGameDiaMond)
                        {
                            Result = true;
                        }
                        break;
                    case '>':
                        if (PlayObject.m_nGAMEDIAMOND > nGameDiaMond)
                        {
                            Result = true;
                        }
                        break;
                    case '<':
                        if (PlayObject.m_nGAMEDIAMOND < nGameDiaMond)
                        {
                            Result = true;
                        }
                        break;
                    default:
                        if (PlayObject.m_nGAMEDIAMOND >= nGameDiaMond)
                        {
                            Result = true;
                        }
                        break;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckGameDiaMond");
            }
        }

        /// <summary>
        /// 功能:检查技能等级
        /// CHECKSKILLLEVEL 技能名 控制符(=,>,<) 等级数(0-3) HERO
        /// </summary>
        /// <param name="NormNpc"></param>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <param name="Result"></param>
        private void ConditionOfCheckSkillLevel(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo,
            ref bool Result)
        {
            Result = false;
            TUserMagic UserMagic;
            int nLevel;
            string cMethod;
            string sMagicName;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                nLevel = HUtil32._MIN(3, HUtil32.Str_ToInt(QuestConditionInfo.sParam3, 0));
                sMagicName = GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam1);
                cMethod = QuestConditionInfo.sParam2[0].ToString();
                if ((nLevel < 0) || (sMagicName == "") && (cMethod == ""))
                {
                    ScriptConditionError(NormNpc, PlayObject, QuestConditionInfo, M2Share.sSC_CHECKSKILLLEVEL);
                    return;
                }
                if ((QuestConditionInfo.sParam4).ToLower().CompareTo(("HERO").ToLower()) == 0)
                {
                    if (PlayObject.m_MyHero != null)
                    {
                        UserMagic = ((TPlayObject)(PlayObject.m_MyHero)).GetMagicInfo(sMagicName);
                        if (UserMagic != null)
                        {
                            switch (cMethod)
                            {
                                case "=":
                                    if (UserMagic.btLevel == nLevel)
                                    {
                                        Result = true;
                                    }
                                    break;
                                case ">":
                                    if (UserMagic.btLevel > nLevel)
                                    {
                                        Result = true;
                                    }
                                    break;
                                case "<":
                                    if (UserMagic.btLevel < nLevel)
                                    {
                                        Result = true;
                                    }
                                    break;
                                default:
                                    if (UserMagic.btLevel >= nLevel)
                                    {
                                        Result = true;
                                    }
                                    break;
                            }
                        }
                    }
                }
                else
                {
                    UserMagic = PlayObject.GetMagicInfo(sMagicName);
                    if (UserMagic != null)
                    {
                        switch (cMethod)
                        {
                            case "=":
                                if (UserMagic.btLevel == nLevel)
                                {
                                    Result = true;
                                }
                                break;
                            case ">":
                                if (UserMagic.btLevel > nLevel)
                                {
                                    Result = true;
                                }
                                break;
                            case "<":
                                if (UserMagic.btLevel < nLevel)
                                {
                                    Result = true;
                                }
                                break;
                            default:
                                if (UserMagic.btLevel >= nLevel)
                                {
                                    Result = true;
                                }
                                break;
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCHECKSKILLLEVEL");
            }
        }

        /// <summary>
        /// 功能:检查地图指定坐标指定名称怪物数量
        /// CHECKMAPMOBCOUNT 地图 X Y 怪名 ><= 数量 范围
        /// </summary>
        /// <param name="NormNpc"></param>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <param name="Result"></param>
        private void ConditionOfCheckMapMobCount(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo,
            ref bool Result)
        {
            Result = false;
            char cMethod;
            int nCount;
            int MonCount;
            Envirnoment Envir;
            string sMap;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                nCount = HUtil32.Str_ToInt(QuestConditionInfo.sParam6, -1);// 数量
                sMap = GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam1);// 地图ID 支持变量
                Envir = M2Share.g_MapManager.FindMap(sMap);
                MonCount = M2Share.UserEngine.GetMapMonsterCount(Envir, QuestConditionInfo.nParam2, QuestConditionInfo.nParam3, QuestConditionInfo.nParam7, QuestConditionInfo.sParam4.Trim());
                cMethod = QuestConditionInfo.sParam5[0];
                switch (cMethod)
                {
                    case '=':
                        // 比较怪物数量
                        if (MonCount == nCount)
                        {
                            Result = true;
                        }
                        break;
                    case '>':
                        if (MonCount > nCount)
                        {
                            Result = true;
                        }
                        break;
                    case '<':
                        if (MonCount < nCount)
                        {
                            Result = true;
                        }
                        break;
                    default:
                        if (MonCount >= nCount)
                        {
                            Result = true;
                        }
                        break;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCHECKMAPMOBCOUNT");
            }
        }

        /// <summary>
        /// 功能:检查人物周围自己宝宝数量
        /// 格式：CHECKSIDESLAVENAME 怪物名称(*代表所有) 范围 (>,<,=) 数量
        /// </summary>
        /// <param name="NormNpc"></param>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <param name="Result"></param>
        private void ConditionOfChecksideslaveName(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo,
            ref bool Result)
        {
            Result = false;
            string sMonName;
            char cMethod;
            int nCount;
            int nRange;
            int slavCount;
            List<TBaseObject> MonList;
            TBaseObject MoveMon;
            TBaseObject Slave;
            bool boAllSlave;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                boAllSlave = false;
                slavCount = 0;
                sMonName = GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam1);// 怪物名称
                nRange = HUtil32.Str_ToInt(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam2), -1);// 范围 支持变量
                nCount = HUtil32.Str_ToInt(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam4), -1);// 数量 支持变量
                cMethod = QuestConditionInfo.sParam3[0];// 操作符
                if (sMonName == "*")
                {
                    boAllSlave = true;
                }
                MonList = new List<TBaseObject>();
                try
                {
                    M2Share.UserEngine.GetMapRangeMonster(PlayObject.m_PEnvir, PlayObject.m_nCurrX, PlayObject.m_nCurrY, nRange, MonList);// 查指定XY范围内的怪
                    if (MonList.Count > 0)
                    {
                        for (int i = 0; i < MonList.Count; i++)
                        {
                            MoveMon = MonList[i];
                            if (PlayObject.m_SlaveList.Count > 0)
                            {
                                for (int K = 0; K < PlayObject.m_SlaveList.Count; K++)
                                {
                                    Slave = PlayObject.m_SlaveList[K];
                                    if ((Slave != null))
                                    {
                                        if (!boAllSlave)
                                        {
                                            if (((Slave.m_sCharName).ToLower().CompareTo((sMonName).ToLower()) == 0) && (Slave == MoveMon))
                                            {
                                                slavCount++;
                                            }
                                        }
                                        else if ((Slave == MoveMon))
                                        {
                                            slavCount++;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                finally
                {
                    MonList = null;
                }
                switch (cMethod)
                {
                    case '=':
                        // 比较怪物数量
                        if (slavCount == nCount)
                        {
                            Result = true;
                        }
                        break;
                    case '>':
                        if (slavCount > nCount)
                        {
                            Result = true;
                        }
                        break;
                    case '<':
                        if (slavCount < nCount)
                        {
                            Result = true;
                        }
                        break;
                    default:
                        if (slavCount >= nCount)
                        {
                            Result = true;
                        }
                        break;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCHECKSIDESLAVENAME");
            }
        }

        private void ConditionOfCheckGameGird(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo,
            ref bool Result)
        {
            Result = false;
            char cMethod;
            int nGameGird;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                nGameGird = HUtil32.Str_ToInt(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam2), -1);
                if (nGameGird < 0)
                {
                    if (!GetValValue(PlayObject, QuestConditionInfo.sParam2, ref nGameGird))
                    {
                        ScriptConditionError(NormNpc, PlayObject, QuestConditionInfo, M2Share.sSC_CHECKGAMEGIRD);
                        return;
                    }
                }
                cMethod = QuestConditionInfo.sParam1[0];
                switch (cMethod)
                {
                    case '=':
                        if (PlayObject.m_nGAMEGIRD == nGameGird)
                        {
                            Result = true;
                        }
                        break;
                    case '>':
                        if (PlayObject.m_nGAMEGIRD > nGameGird)
                        {
                            Result = true;
                        }
                        break;
                    case '<':
                        if (PlayObject.m_nGAMEGIRD < nGameGird)
                        {
                            Result = true;
                        }
                        break;
                    default:
                        if (PlayObject.m_nGAMEGIRD >= nGameGird)
                        {
                            Result = true;
                        }
                        break;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckGameGird");
            }
        }

        private void ConditionOfCheckGameGlory(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo,
            ref bool Result)
        {
            Result = false;
            char cMethod;
            int nGameGlory;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                nGameGlory = HUtil32.Str_ToInt(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam2), -1);
                if (nGameGlory < 0)
                {
                    if (!GetValValue(PlayObject, QuestConditionInfo.sParam2, ref nGameGlory))
                    {
                        ScriptConditionError(NormNpc, PlayObject, QuestConditionInfo, M2Share.sSC_CHECKGAMEGLORY);
                        return;
                    }
                }
                cMethod = QuestConditionInfo.sParam1[0];
                switch (cMethod)
                {
                    case '=':
                        if (PlayObject.m_btGameGlory == nGameGlory)
                        {
                            Result = true;
                        }
                        break;
                    case '>':
                        if (PlayObject.m_btGameGlory > nGameGlory)
                        {
                            Result = true;
                        }
                        break;
                    case '<':
                        if (PlayObject.m_btGameGlory < nGameGlory)
                        {
                            Result = true;
                        }
                        break;
                    default:
                        if (PlayObject.m_btGameGlory >= nGameGlory)
                        {
                            Result = true;
                        }
                        break;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckGameGLORY");
            }
        }

        private void ConditionOfIsLockStorage(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo,
            ref bool Result)
        {
            Result = false;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = !PlayObject.m_boCanGetBackItem;
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfIsLockStorage");
            }
        }

        private void ConditionOfLockPassword(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo,
            ref bool Result)
        {
            Result = false;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = PlayObject.m_boPasswordLocked;
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfIsLockPassword");
            }
        }

        private void ConditionOfCheckOfGuild(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo,
            ref bool Result)
        {
            Result = false;
            string sGuildName = string.Empty;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                if (QuestConditionInfo.sParam1 == "")
                {
                    ScriptConditionError(NormNpc, PlayObject, QuestConditionInfo, M2Share.sSC_CHECKOFGUILD);
                    return;
                }
                if ((PlayObject.m_MyGuild != null))
                {
                    if (!GetValValue(PlayObject, QuestConditionInfo.sParam1, ref sGuildName))// 增加变量支持
                    {
                        sGuildName = QuestConditionInfo.sParam1;
                    }
                    if (PlayObject.m_MyGuild.sGuildName.ToLower().CompareTo(sGuildName.ToLower()) == 0)
                    {
                        Result = true;
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckOfGuild");
            }
        }

        private void ConditionOfCheckOnlineLongMin(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo,
            ref bool Result)
        {
            Result = false;
            char cMethod;
            int nOnlineMin;
            int nOnlineTime;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                nOnlineMin = HUtil32.Str_ToInt(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam2), -1);
                if (nOnlineMin < 0)
                {
                    if (!GetValValue(PlayObject, QuestConditionInfo.sParam2, ref nOnlineMin))
                    {
                        ScriptConditionError(NormNpc,PlayObject, QuestConditionInfo, M2Share.sSC_ONLINELONGMIN);
                        return;
                    }
                }
                nOnlineTime = Convert.ToInt32((HUtil32.GetTickCount() - PlayObject.m_dwLogonTick) / 60000);
                cMethod = QuestConditionInfo.sParam1[0];
                switch (cMethod)
                {
                    case '=':
                        if (nOnlineTime == nOnlineMin)
                        {
                            Result = true;
                        }
                        break;
                    case '>':
                        if (nOnlineTime > nOnlineMin)
                        {
                            Result = true;
                        }
                        break;
                    case '<':
                        if (nOnlineTime < nOnlineMin)
                        {
                            Result = true;
                        }
                        break;
                    default:
                        if (nOnlineTime >= nOnlineMin)
                        {
                            Result = true;
                        }
                        break;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckOnlineLongMin");
            }
        }

        private void ConditionOfCheckPasswordErrorCount(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo,
            ref bool Result)
        {
            Result = false;
            int nErrorCount;
            char cMethod;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                nErrorCount = HUtil32.Str_ToInt(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam2), -1);
                if (nErrorCount < 0)
                {
                    if (!GetValValue(PlayObject, QuestConditionInfo.sParam2, ref nErrorCount))
                    {
                        ScriptConditionError(NormNpc, PlayObject, QuestConditionInfo, M2Share.sSC_PASSWORDERRORCOUNT);
                        return;
                    }
                }
                cMethod = QuestConditionInfo.sParam1[0];
                switch (cMethod)
                {
                    case '=':
                        if (PlayObject.m_btPwdFailCount == nErrorCount)
                        {
                            Result = true;
                        }
                        break;
                    case '>':
                        if (PlayObject.m_btPwdFailCount > nErrorCount)
                        {
                            Result = true;
                        }
                        break;
                    case '<':
                        if (PlayObject.m_btPwdFailCount < nErrorCount)
                        {
                            Result = true;
                        }
                        break;
                    default:
                        if (PlayObject.m_btPwdFailCount >= nErrorCount)
                        {
                            Result = true;
                        }
                        break;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckPasswordErrorCount");
            }
        }

        private void ConditionOfCheckPayMent(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo,
            ref bool Result)
        {
            Result = false;
            int nPayMent;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                nPayMent = HUtil32.Str_ToInt(QuestConditionInfo.sParam1, -1);
                if (nPayMent < 1)
                {
                    if (!GetValValue(PlayObject, QuestConditionInfo.sParam1, ref nPayMent)) // 增加变量支持
                    {
                        ScriptConditionError(NormNpc, PlayObject, QuestConditionInfo, M2Share.sSC_CHECKPAYMENT);
                        return;
                    }
                }
                if (PlayObject.m_nPayMent == nPayMent)
                {
                    Result = true;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckPayMent");
            }
        }

        private void ConditionOfCheckNameDateList(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo,
            ref bool Result)
        {
            TStringList LoadList;
            string sListFileName;
            string sLineText;
            string sHumName = string.Empty;
            string sDate = string.Empty;
            bool boDeleteExprie;
            bool boNoCompareHumanName;
            DateTime dOldDate;
            char cMethod;
            int nValNo;
            int nValNoDay;
            int nDayCount;
            int nDay;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                nDayCount = HUtil32.Str_ToInt(QuestConditionInfo.sParam3, -1);
                nValNo = M2Share.GetValNameNo(QuestConditionInfo.sParam4);
                nValNoDay = M2Share.GetValNameNo(QuestConditionInfo.sParam5);
                boDeleteExprie = (QuestConditionInfo.sParam6).ToLower().CompareTo(("清理").ToLower()) == 0;
                boNoCompareHumanName = (QuestConditionInfo.sParam6).ToLower().CompareTo(("1").ToLower()) == 0;
                cMethod = QuestConditionInfo.sParam2[0];
                if (nDayCount < 0)
                {
                    ScriptConditionError(NormNpc, PlayObject, QuestConditionInfo, M2Share.sSC_CHECKNAMEDATELIST);
                    return;
                }
                sListFileName = M2Share.g_Config.sEnvirDir + NormNpc.m_sPath + QuestConditionInfo.sParam1;
                if (File.Exists(sListFileName))
                {
                    LoadList = new TStringList();
                    try
                    {

                        LoadList.LoadFromFile(sListFileName);
                    }
                    catch
                    {
                        M2Share.MainOutMessage("加载失败.... => " + sListFileName);
                    }
                    if (LoadList.Count > 0)
                    {
                        for (var i = 0; i < LoadList.Count; i++)
                        {
                            sLineText = LoadList[i].Trim();
                            sLineText = HUtil32.GetValidStr3(sLineText, ref sHumName, new string[] { " ", "\09" });
                            sLineText = HUtil32.GetValidStr3(sLineText, ref sDate, new string[] { " ", "\09" });
                            if (((sHumName).ToLower().CompareTo((PlayObject.m_sCharName).ToLower()) == 0) || boNoCompareHumanName)
                            {
                                nDay = Int32.MaxValue;
                                //if (TryStrToDateTime(sDate, dOldDate))
                                //{
                                //    nDay = HUtil32.GetDayCount(DateTime.Now, dOldDate);
                                //}
                                switch (cMethod)
                                {
                                    case '=':
                                        if (nDay == nDayCount)
                                        {
                                            Result = true;
                                        }
                                        break;
                                    case '>':
                                        if (nDay > nDayCount)
                                        {
                                            Result = true;
                                        }
                                        break;
                                    case '<':
                                        if (nDay < nDayCount)
                                        {
                                            Result = true;
                                        }
                                        break;
                                    default:
                                        if (nDay >= nDayCount)
                                        {
                                            Result = true;
                                        }
                                        break;
                                }
                                if (nValNo >= 0)
                                {
                                    switch (nValNo)
                                    {
                                        // Modify the A .. B: 0 .. 99
                                        case 0:
                                            PlayObject.m_nVal[nValNo] = nDay;
                                            break;
                                        // Modify the A .. B: 100 .. 199
                                        case 100:
                                            M2Share.g_Config.GlobalVal[nValNo - 100] = nDay;
                                            break;
                                        // Modify the A .. B: 200 .. 299
                                        case 200:
                                            PlayObject.m_DyVal[nValNo - 200] = nDay;
                                            break;
                                        // Modify the A .. B: 300 .. 399
                                        case 300:
                                            PlayObject.m_nMval[nValNo - 300] = nDay;
                                            break;
                                        // Modify the A .. B: 400 .. 499
                                        case 400:
                                            M2Share.g_Config.GlobaDyMval[nValNo - 400] = nDay;
                                            break;
                                        // Modify the A .. B: 500 .. 599
                                        case 500:
                                            PlayObject.m_nInteger[nValNo - 500] = nDay;
                                            break;
                                        // Modify the A .. B: 800 .. 1199
                                        case 800:
                                            // 20080903 G变量
                                            M2Share.g_Config.GlobalVal[nValNo - 700] = nDay;
                                            break;
                                    }
                                }
                                if (nValNoDay >= 0)
                                {
                                    switch (nValNoDay)
                                    {
                                        // Modify the A .. B: 0 .. 99
                                        case 0:
                                            PlayObject.m_nVal[nValNoDay] = nDayCount - nDay;
                                            break;
                                        // Modify the A .. B: 100 .. 199
                                        case 100:
                                            M2Share.g_Config.GlobalVal[nValNoDay - 100] = nDayCount - nDay;
                                            break;
                                        // Modify the A .. B: 200 .. 299
                                        case 200:
                                            PlayObject.m_DyVal[nValNoDay - 200] = nDayCount - nDay;
                                            break;
                                        // Modify the A .. B: 300 .. 399
                                        case 300:
                                            PlayObject.m_nMval[nValNoDay - 300] = nDayCount - nDay;
                                            break;
                                        // Modify the A .. B: 400 .. 499
                                        case 400:
                                            M2Share.g_Config.GlobaDyMval[nValNo - 400] = nDayCount - nDay;
                                            break;
                                        // Modify the A .. B: 500 .. 599
                                        case 500:
                                            PlayObject.m_nInteger[nValNo - 500] = nDayCount - nDay;
                                            break;
                                        // Modify the A .. B: 800 .. 1199
                                        case 800:
                                            // 20080903 G变量
                                            M2Share.g_Config.GlobalVal[nValNoDay - 700] = nDayCount - nDay;
                                            break;
                                    }
                                }
                                if (!Result)
                                {
                                    if (boDeleteExprie)
                                    {
                                        LoadList.RemoveAt(i);
                                        try
                                        {

                                            LoadList.SaveToFile(sListFileName);
                                        }
                                        catch
                                        {
                                            M2Share.MainOutMessage("保存失败.... => " + sListFileName);
                                        }
                                    }
                                }
                                break;
                            }
                        }
                    }
                    LoadList = null;
                }
                else
                {
                    M2Share.MainOutMessage("文件没有找到 => " + sListFileName);
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckNameDateList");
            }
        }

        // CHECKMAPHUMANCOUNT MAP = COUNT
        private void ConditionOfCheckMapHumanCount(TNormNpc NormNpc, TPlayObject PlayObject,  TQuestConditionInfo QuestConditionInfo,
            ref bool Result)
        {
            Result = false;
            int nCount;
            int nHumanCount;
            char cMethod;
            string sMapName = string.Empty;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                nCount = HUtil32.Str_ToInt(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam3), -1);
                if (nCount < 0)
                {
                    if (!GetValValue(PlayObject, QuestConditionInfo.sParam3, ref nCount))// 增加变量支持
                    {
                        ScriptConditionError(NormNpc,PlayObject, QuestConditionInfo, M2Share.sSC_CHECKMAPHUMANCOUNT);
                        return;
                    }
                }
                if (!GetValValue(PlayObject, QuestConditionInfo.sParam1, ref sMapName))// 增加变量支持
                {
                    sMapName = QuestConditionInfo.sParam1;
                }
                nHumanCount = M2Share.UserEngine.GetMapHuman(sMapName);
                cMethod = QuestConditionInfo.sParam2[1];
                switch (cMethod)
                {
                    case '=':
                        if (nHumanCount == nCount)
                        {
                            Result = true;
                        }
                        break;
                    case '>':
                        if (nHumanCount > nCount)
                        {
                            Result = true;
                        }
                        break;
                    case '<':
                        if (nHumanCount < nCount)
                        {
                            Result = true;
                        }
                        break;
                    default:
                        if (nHumanCount >= nCount)
                        {
                            Result = true;
                        }
                        break;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckMapHumanCount");
            }
        }

        /// <summary>
        /// 检查地图怪物数量
        /// </summary>
        /// <param name="NormNpc"></param>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <param name="Result"></param>
        private void ConditionOfCheckMapMonCount(TNormNpc NormNpc, TPlayObject PlayObject,  TQuestConditionInfo QuestConditionInfo,
            ref bool Result)
        {
            Result = false;
            int nCount;
            int nMonCount;
            char cMethod;
            Envirnoment Envir;
            string sMap;
            List<TBaseObject> MonList;
            TBaseObject BaseObject;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                nCount = HUtil32.Str_ToInt(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam3), -1);
                if ((QuestConditionInfo.sParam1).ToLower().CompareTo(("Self").ToLower()) == 0)
                {
                    sMap = PlayObject.m_sMapName;
                }
                else
                {
                    sMap = QuestConditionInfo.sParam1;
                    if ((sMap != "") && (sMap[0] == '<') && (sMap[1] == '$'))// 增加支持<$Str()>
                    {
                        sMap = GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam1);
                    }
                    else
                    {
                        GetValValue(PlayObject, QuestConditionInfo.sParam1, ref sMap);
                    }
                }
                Envir = M2Share.g_MapManager.FindMap(sMap);
                if (nCount < 0)
                {
                    GetValValue(PlayObject, QuestConditionInfo.sParam3, ref nCount);
                }
                if ((nCount < 0) || (Envir == null))
                {
                    ScriptConditionError(NormNpc, PlayObject, QuestConditionInfo, M2Share.sSC_CHECKMAPMONCOUNT);
                    return;
                }
                MonList = new List<TBaseObject>();
                try
                {
                    M2Share.UserEngine.GetMapMonster(Envir, MonList);
                    for (int i = MonList.Count - 1; i >= 0; i--)
                    {
                        if (MonList.Count <= 0)
                        {
                            break;
                        }
                        BaseObject = MonList[i];
                        if ((BaseObject.m_btRaceServer < Grobal2.RC_ANIMAL) || (BaseObject.m_btRaceServer == Grobal2.RC_ARCHERGUARD) ||
                            (BaseObject.m_Master != null) || (BaseObject.m_btRaceServer == Grobal2.RC_NPC) || (BaseObject.m_btRaceServer == Grobal2.RC_PEACENPC))
                        {
                            MonList.RemoveAt(i);
                        }
                    }
                    nMonCount = MonList.Count;
                    cMethod = QuestConditionInfo.sParam2[1];
                    switch (cMethod)
                    {
                        case '=':
                            if (nMonCount == nCount)
                            {
                                Result = true;
                            }
                            break;
                        case '>':
                            if (nMonCount > nCount)
                            {
                                Result = true;
                            }
                            break;
                        case '<':
                            if (nMonCount < nCount)
                            {
                                Result = true;
                            }
                            break;
                        default:
                            if (nMonCount >= nCount)
                            {
                                Result = true;
                            }
                            break;
                    }
                }
                finally
                {
                    MonList = null;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckMapMonCount");
            }
        }

        /// <summary>
        /// 检测地图命令
        /// 格式:ISONMAP 地图
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <returns></returns>
        private void ConditionOfIosnMap(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            string sMapName;
            Envirnoment Envir;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                sMapName = GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam1);// 地图支持变量
                Envir = M2Share.g_MapManager.FindMap(sMapName);
                if (Envir == null)
                {
                    ScriptConditionError(NormNpc, PlayObject, QuestConditionInfo, M2Share.sSC_ISONMAP);
                    return;
                }
                if (PlayObject.m_PEnvir == Envir)
                {
                    Result = true;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfISONMAP");
            }
        }

        private void ConditionOfActMission(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo,
            ref bool Result)
        {
            Result = false;
        }

        private void ConditionOfCheckMonMapCount(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo,
            ref bool Result)
        {
            Result = false;
            string sMapName;
            int nCount;
            int nMapRangeCount;
            Envirnoment Envir;
            List<TBaseObject> MonList;
            TBaseObject BaseObject;
            byte nCode;
            nCode = 0;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                sMapName = QuestConditionInfo.sParam1;
                nCode = 1;
                nCount = HUtil32.Str_ToInt(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam2), -1);
                if (nCount < 0)
                {
                    GetValValue(PlayObject, QuestConditionInfo.sParam2, ref nCount);
                }
                nCode = 2;
                Envir = M2Share.g_MapManager.FindMap(sMapName);
                if ((Envir == null) || (nCount < 0))
                {
                    ScriptConditionError(NormNpc, PlayObject, QuestConditionInfo, M2Share.sCHECKMONMAP);
                    return;
                }
                nCode = 3;
                MonList = new List<TBaseObject>();
                try
                {
                    nCode = 4;
                    nMapRangeCount = M2Share.UserEngine.GetMapMonster(Envir, MonList);
                    nCode = 5;
                    for (int i = MonList.Count - 1; i >= 0; i--)
                    {
                        if (MonList.Count <= 0)
                        {
                            break;
                        }
                        nCode = 6;
                        BaseObject = MonList[i];
                        if (BaseObject != null)
                        {
                            nCode = 7;
                            if ((BaseObject.m_btRaceServer < Grobal2.RC_ANIMAL) || (BaseObject.m_btRaceServer == Grobal2.RC_ARCHERGUARD) ||
                                (BaseObject.m_Master != null) || (BaseObject.m_btRaceServer == Grobal2.RC_NPC) || (BaseObject.m_btRaceServer == Grobal2.RC_PEACENPC))
                            {
                                MonList.RemoveAt(i);
                            }
                        }
                    }
                    nCode = 8;
                    nMapRangeCount = MonList.Count;
                    if (nMapRangeCount >= nCount)
                    {
                        Result = true;
                    }
                }
                finally
                {
                    MonList = null;
                    //MonList.Free;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckMonMapCount Code:" + (nCode).ToString());
            }
        }

        /// <summary>
        /// 可以检查一个坐标范围内怪物数量
        /// 格式：CheckRangeMonCount 地图号 X坐标 Y坐标 范围 控制符(=,>,<) 数量
        /// </summary>
        /// <param name="NormNpc"></param>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <param name="Result"></param>
        private void ConditionOfCheckRangeMonCount(TNormNpc NormNpc, TPlayObject PlayObject,  TQuestConditionInfo QuestConditionInfo,
            ref bool Result)
        {
            Result = false;
            string sMapName;
            int nX;
            int nY;
            int nRange;
            int nCount;
            char cMethod = '0';
            int nMapRangeCount;
            Envirnoment Envir;
            IList<TPlayObject> MonList;
            TBaseObject BaseObject;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                sMapName = GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam1);// 地图支持变量
                nX = HUtil32.Str_ToInt(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam2), -1);
                nY = HUtil32.Str_ToInt(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam3), -1);
                nRange = HUtil32.Str_ToInt(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam4), -1);
                nCount = HUtil32.Str_ToInt(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam6), -1);
                if (QuestConditionInfo.sParam5 != "")
                {
                    cMethod = QuestConditionInfo.sParam5[0];
                }
                if (nX < 0)
                {
                    GetValValue(PlayObject, QuestConditionInfo.sParam2, ref nX);
                }
                if (nY < 0)
                {
                    GetValValue(PlayObject, QuestConditionInfo.sParam3, ref nY);
                }
                if (nRange < 0)
                {
                    GetValValue(PlayObject, QuestConditionInfo.sParam4, ref nRange);
                }
                if (nCount < 0)
                {
                    GetValValue(PlayObject, QuestConditionInfo.sParam6, ref nCount);
                }
                Envir = M2Share.g_MapManager.FindMap(sMapName);
                if ((Envir == null) || (nX < 0) || (nY < 0) || (nRange < 0) || (nCount < 0))
                {
                    ScriptConditionError(NormNpc, PlayObject, QuestConditionInfo, M2Share.sSC_CHECKRANGEMONCOUNT);
                    return;
                }
                MonList = new List<TPlayObject>();
                try
                {
                    nMapRangeCount = Envir.GetRangeBaseObject(nX, nY, nRange, true, MonList);
                    for (var i = MonList.Count - 1; i >= 0; i--)
                    {
                        if (MonList.Count <= 0)
                        {
                            break;
                        }
                        BaseObject = ((TBaseObject)(MonList[i]));
                        if (BaseObject != null)
                        {
                            if ((BaseObject.m_btRaceServer < Grobal2.RC_ANIMAL) || (BaseObject.m_btRaceServer == Grobal2.RC_ARCHERGUARD)
                                || (BaseObject.m_Master != null) || (BaseObject.m_btRaceServer == Grobal2.RC_NPC)
                                || (BaseObject.m_btRaceServer == Grobal2.RC_PEACENPC))
                            {
                                MonList.RemoveAt(i);
                            }
                        }
                    }
                    nMapRangeCount = MonList.Count;
                    switch (cMethod)
                    {
                        case '=':
                            if (nMapRangeCount == nCount)
                            {
                                Result = true;
                            }
                            break;
                        case '>':
                            if (nMapRangeCount > nCount)
                            {
                                Result = true;
                            }
                            break;
                        case '<':
                            if (nMapRangeCount < nCount)
                            {
                                Result = true;
                            }
                            break;
                        default:
                            if (nMapRangeCount >= nCount)
                            {
                                Result = true;
                            }
                            break;
                    }
                }
                finally
                {
                    MonList = null;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckRangeMonCount");
            }
        }

        /// <summary>
        /// 功能：检查装备升级次数。
        /// 格式：CHECKITEMLEVEL 物品位置(0-13) (符号 < > =) 值
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <returns></returns>
        private void ConditionOfCheckItemLevel(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo,
            ref bool Result)
        {
            Result = false;
            int nWhere;
            int nPoint;
            TUserItem UserItem;
            char cMethod;
            try
            {
                Result = false;
                nWhere = HUtil32.Str_ToInt(QuestConditionInfo.sParam1, -1);// 物品位置
                nPoint = HUtil32.Str_ToInt(QuestConditionInfo.sParam3, -1);// 值
                if ((nWhere < 0) || (nWhere > PlayObject.m_UseItems.GetUpperBound(0)) || (nPoint < 0) || (nPoint > 255))
                {
                    ScriptConditionError(NormNpc,PlayObject, QuestConditionInfo, M2Share.sSC_CHECKITEMLEVEL);
                    return;
                }
                UserItem = PlayObject.m_UseItems[nWhere];
                if (UserItem.wIndex <= 0)
                {
                    return;
                }
                cMethod = QuestConditionInfo.sParam2[0];
                switch (cMethod)// 操作符
                {
                    case '=':
                        if (UserItem.btValue[9] == nPoint)
                        {
                            Result = true;
                        }
                        break;
                    case '>':
                        if (UserItem.btValue[9] > nPoint)
                        {
                            Result = true;
                        }
                        break;
                    case '<':
                        if (UserItem.btValue[9] < nPoint)
                        {
                            Result = true;
                        }
                        break;
                    default:
                        if (UserItem.btValue[9] >= nPoint)
                        {
                            Result = true;
                        }
                        break;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCHECKITEMLEVEL");
            }
        }

        public bool ConditionOfCheckMemoryItem_IsRememberItem(TUserItem UserItem)
        {
            bool Result = false;
            TStdItem StdItem = M2Share.UserEngine.GetStdItem(UserItem.wIndex);
            if (StdItem == null)
            {
                return Result;
            }
            return Result = (StdItem.StdMode == 31) && (StdItem.AniCount != 0) && (StdItem.Shape == 1);
        }

        private void ConditionOfCheckReNewLevel(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo,
            ref bool Result)
        {
            Result = false;
            int nLevel;
            char cMethod;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                nLevel = HUtil32.Str_ToInt(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam2), -1);
                if (nLevel < 0)
                {
                    if (!GetValValue(PlayObject, QuestConditionInfo.sParam2, ref nLevel))
                    {
                        ScriptConditionError(NormNpc, PlayObject, QuestConditionInfo, M2Share.sSC_CHECKRENEWLEVEL);
                        return;
                    }
                }
                cMethod = QuestConditionInfo.sParam1[0];
                switch (cMethod)
                {
                    case '=':
                        if (PlayObject.m_btReLevel == nLevel)
                        {
                            Result = true;
                        }
                        break;
                    case '>':
                        if (PlayObject.m_btReLevel > nLevel)
                        {
                            Result = true;
                        }
                        break;
                    case '<':
                        if (PlayObject.m_btReLevel < nLevel)
                        {
                            Result = true;
                        }
                        break;
                    default:
                        if (PlayObject.m_btReLevel >= nLevel)
                        {
                            Result = true;
                        }
                        break;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckReNewLevel");
            }
        }

        private void ConditionOfCheckSlaveLevel(TNormNpc NormNpc, TPlayObject PlayObject,  TQuestConditionInfo QuestConditionInfo,
            ref bool Result)
        {
            Result = false;
            int nLevel;
            char cMethod;
            TBaseObject BaseObject;
            int nSlaveLevel;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                nLevel = HUtil32.Str_ToInt(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam2), -1);
                if (nLevel < 0)
                {
                    if (!GetValValue(PlayObject, QuestConditionInfo.sParam2, ref nLevel))
                    {
                        ScriptConditionError(NormNpc, PlayObject, QuestConditionInfo, M2Share.sSC_CHECKSLAVELEVEL);
                        return;
                    }
                }
                nSlaveLevel = -1;
                if (PlayObject.m_SlaveList.Count > 0)
                {
                    for (int i = 0; i < PlayObject.m_SlaveList.Count; i++)
                    {
                        BaseObject = ((TBaseObject)(PlayObject.m_SlaveList[i]));
                        if (BaseObject.m_Abil.Level > nSlaveLevel)
                        {
                            nSlaveLevel = BaseObject.m_Abil.Level;
                        }
                    }
                }
                if (nSlaveLevel < 0)
                {
                    return;
                }
                cMethod = QuestConditionInfo.sParam1[0];
                switch (cMethod)
                {
                    case '=':
                        if (nSlaveLevel == nLevel)
                        {
                            Result = true;
                        }
                        break;
                    case '>':
                        if (nSlaveLevel > nLevel)
                        {
                            Result = true;
                        }
                        break;
                    case '<':
                        if (nSlaveLevel < nLevel)
                        {
                            Result = true;
                        }
                        break;
                    default:
                        if (nSlaveLevel >= nLevel)
                        {
                            Result = true;
                        }
                        break;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckSlaveLevel");
            }
        }

        private void ConditionOfCheckVar(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo,
            ref bool Result)
        {
            string sType;
            string sVarName;
            string sVarValue;
            long nVarValue;
            string sName = string.Empty;
            string sMethod;
            char cMethod;
            TDynamicVar DynamicVar;
            bool boFoundVar = false;
            IList<TDynamicVar> DynamicVarList;
            Result = false;
            sType = QuestConditionInfo.sParam1;
            sVarName = QuestConditionInfo.sParam2;
            sMethod = QuestConditionInfo.sParam3;
            nVarValue = HUtil32.Str_ToInt(QuestConditionInfo.sParam4, 0);
            sVarValue = QuestConditionInfo.sParam4;
            if ((sType == "") || (sVarName == "") || (sMethod == ""))
            {
                ScriptConditionError(NormNpc, PlayObject, QuestConditionInfo, M2Share.sSC_CHECKVAR);
                return;
            }
            cMethod = sMethod[1];
            DynamicVarList = GetDynamicVarList(PlayObject, sType, ref sName);
            if (DynamicVarList == null)
            {
                ScriptConditionError(NormNpc, PlayObject, QuestConditionInfo, M2Share.sSC_CHECKVAR);
                return;
            }
            else
            {
                for (int i = 0; i < DynamicVarList.Count; i++)
                {
                    DynamicVar = DynamicVarList[i];
                    if ((DynamicVar.sName).ToLower().CompareTo((sVarName).ToLower()) == 0)
                    {
                        switch (DynamicVar.VarType)
                        {
                            case TVarType.vInteger:
                                switch (cMethod)
                                {
                                    case '=':
                                        if (DynamicVar.nInternet == nVarValue)
                                        {
                                            Result = true;
                                        }
                                        break;

                                    case '>':
                                        if (DynamicVar.nInternet > nVarValue)
                                        {
                                            Result = true;
                                        }
                                        break;

                                    case '<':
                                        if (DynamicVar.nInternet < nVarValue)
                                        {
                                            Result = true;
                                        }
                                        break;
                                    default:
                                        if (DynamicVar.nInternet >= nVarValue)
                                        {
                                            Result = true;
                                        }
                                        break;
                                }
                                break;

                            case TVarType.vString:
                                switch (cMethod)
                                {
                                    case '=':
                                        if (DynamicVar.sString == sVarValue)
                                        {
                                            Result = true;
                                        }
                                        break;
                                }
                                break;
                        }
                        boFoundVar = true;
                        break;
                    }
                }
                if (!boFoundVar)
                {
                    ScriptConditionError(NormNpc, PlayObject, QuestConditionInfo, M2Share.sSC_CHECKVAR);
                }
            }
        }

        private void ConditionOfHaveMaster(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo,
            ref bool Result)
        {
            Result = false;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                if (PlayObject.m_sMasterName != "")
                {
                    Result = true;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfHaveMaster");
            }
        }

        private void ConditionOfPoseHaveMaster(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo,
            ref bool Result)
        {
            Result = false;
            TBaseObject PoseHuman;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                PoseHuman = PlayObject.GetPoseCreate();
                if ((PoseHuman != null) && (PoseHuman.m_btRaceServer == Grobal2.RC_PLAYOBJECT))
                {
                    if ((((TPlayObject)(PoseHuman)).m_sMasterName != ""))
                    {
                        Result = true;
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfPoseHaveMaster");
            }
        }

        private void ConditionOfCheckCastleGold(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo,
            ref bool Result)
        {
            Result = false;
            char cMethod;
            int nGold;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                nGold = HUtil32.Str_ToInt(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam2), -1);
                if (nGold < 0)
                {
                    GetValValue(PlayObject, QuestConditionInfo.sParam2, ref nGold);
                }
                if ((nGold < 0) || (PlayObject.m_Castle == null))
                {
                    ScriptConditionError(NormNpc,PlayObject, QuestConditionInfo, M2Share.sSC_CHECKCASTLEGOLD);
                    return;
                }
                cMethod = QuestConditionInfo.sParam1[0];
                switch (cMethod)
                {
                    case '=':
                        if (PlayObject.m_Castle.m_nTotalGold == nGold)
                        {
                            Result = true;
                        }
                        break;
                    case '>':
                        if (PlayObject.m_Castle.m_nTotalGold > nGold)
                        {
                            Result = true;
                        }
                        break;
                    case '<':
                        if (PlayObject.m_Castle.m_nTotalGold < nGold)
                        {
                            Result = true;
                        }
                        break;
                    default:
                        if (PlayObject.m_Castle.m_nTotalGold >= nGold)
                        {
                            Result = true;
                        }
                        break;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckCastleGold");
            }
        }

        private void ConditionOfCheckContribution(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo,
            ref bool Result)
        {
            Result = false;
            int nContribution;
            char cMethod;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                nContribution = HUtil32.Str_ToInt(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam2), -1);
                if (nContribution < 0)
                {
                    if (!GetValValue(PlayObject, QuestConditionInfo.sParam2, ref nContribution))
                    {
                        ScriptConditionError(NormNpc, PlayObject, QuestConditionInfo, M2Share.sSC_CHECKCONTRIBUTION);
                        return;
                    }
                }
                cMethod = QuestConditionInfo.sParam1[0];
                switch (cMethod)
                {
                    case '=':
                        if (PlayObject.m_wContribution == nContribution)
                        {
                            Result = true;
                        }
                        break;
                    case '>':
                        if (PlayObject.m_wContribution > nContribution)
                        {
                            Result = true;
                        }
                        break;
                    case '<':
                        if (PlayObject.m_wContribution < nContribution)
                        {
                            Result = true;
                        }
                        break;
                    default:
                        if (PlayObject.m_wContribution >= nContribution)
                        {
                            Result = true;
                        }
                        break;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckContribution");
            }
        }

        private void ConditionOfCheckCreditPoint(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo,
            ref bool Result)
        {
            Result = false;
            int nCreditPoint;
            char cMethod;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                nCreditPoint = HUtil32.Str_ToInt(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam2), -1);
                if (nCreditPoint < 0)
                {
                    if (!GetValValue(PlayObject, QuestConditionInfo.sParam2, ref nCreditPoint))
                    {
                        ScriptConditionError(NormNpc, PlayObject, QuestConditionInfo, M2Share.sSC_CHECKCREDITPOINT);
                        return;
                    }
                }
                cMethod = QuestConditionInfo.sParam1[0];
                switch (cMethod)
                {
                    case '=':
                        if (PlayObject.m_btCreditPoint == nCreditPoint)
                        {
                            Result = true;
                        }
                        break;
                    case '>':
                        if (PlayObject.m_btCreditPoint > nCreditPoint)
                        {
                            Result = true;
                        }
                        break;
                    case '<':
                        if (PlayObject.m_btCreditPoint < nCreditPoint)
                        {
                            Result = true;
                        }
                        break;
                    default:
                        if (PlayObject.m_btCreditPoint >= nCreditPoint)
                        {
                            Result = true;
                        }
                        break;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckCreditPoint");
            }
        }


        private void ConditionOfCheckAccountIPList(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            string sCharName;
            string sCharAccount;
            string sCharIPaddr;
            string sLine;
            string sName = string.Empty;
            string sIPaddr;
            Result = false;
            TStringList LoadList = null;
            try
            {
                sCharName = PlayObject.m_sCharName;
                sCharAccount = PlayObject.m_sUserID;
                sCharIPaddr = PlayObject.m_sIPaddr;
                if (File.Exists(M2Share.g_Config.sEnvirDir + NormNpc.m_sPath + QuestConditionInfo.sParam1))
                {
                    LoadList = new TStringList();
                    LoadList.LoadFromFile(M2Share.g_Config.sEnvirDir + NormNpc.m_sPath + QuestConditionInfo.sParam1);
                    for (int i = 0; i < LoadList.Count; i++)
                    {
                        sLine = LoadList[i];
                        if (sLine[1] == ';')
                        {
                            continue;
                        }
                        sIPaddr = HUtil32.GetValidStr3(sLine, ref sName, new string[] { " ", "/", "\09" });
                        sIPaddr = sIPaddr.Trim();
                        if ((sName == sCharAccount) && (sIPaddr == sCharIPaddr))
                        {
                            Result = true;
                            break;
                        }
                    }
                }
                else
                {
                    ScriptConditionError(NormNpc, PlayObject, QuestConditionInfo, M2Share.sSC_CHECKACCOUNTIPLIST);
                }
            }
            finally
            {
                LoadList = null;
            }
        }

        private void ConditionOfCheckBagSize(TNormNpc NormNpc, TPlayObject PlayObject,  TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            int nSize = 0;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                if (!GetValValue(PlayObject, QuestConditionInfo.sParam1, ref nSize))
                {
                    nSize = QuestConditionInfo.nParam1;
                }
                if ((nSize <= 0) || (nSize > Grobal2.MAXHEROBAGITEM))
                {
                    ScriptConditionError(NormNpc, PlayObject, QuestConditionInfo, M2Share.sSC_CHECKBAGSIZE);
                    return;
                }
                if ((QuestConditionInfo.sParam2).ToLower().CompareTo(("HERO").ToLower()) == 0)
                {
                    if (PlayObject.m_MyHero != null)
                    {
                        if (PlayObject.m_MyHero.m_ItemList.Count + nSize <= Grobal2.MAXHEROBAGITEM)
                        {
                            Result = true;
                        }
                    }
                }
                else
                {
                    if (PlayObject.m_ItemList.Count + nSize <= Grobal2.MAXBAGITEM)
                    {
                        Result = true;
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckBagSize");
            }
        }

        private void ConditionOfCheckBonusPoint(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            int nTotlePoint;
            int nCount = 0;
            char cMethod;
            try
            {
                Result = false;
                nTotlePoint = PlayObject.m_BonusAbil.DC + PlayObject.m_BonusAbil.MC + PlayObject.m_BonusAbil.SC + PlayObject.m_BonusAbil.AC + PlayObject.m_BonusAbil.MAC
                    + PlayObject.m_BonusAbil.HP + PlayObject.m_BonusAbil.MP + PlayObject.m_BonusAbil.Hit + PlayObject.m_BonusAbil.Speed + PlayObject.m_BonusAbil.X2;
                nTotlePoint = nTotlePoint + PlayObject.m_nBonusPoint;
                cMethod = QuestConditionInfo.sParam1[0];
                if (!GetValValue(PlayObject, QuestConditionInfo.sParam2, ref nCount))
                {
                    nCount = QuestConditionInfo.nParam2;
                }
                switch (cMethod)
                {
                    case '=':
                        if (nTotlePoint == nCount)
                        {
                            Result = true;
                        }
                        break;
                    case '>':
                        if (nTotlePoint > nCount)
                        {
                            Result = true;
                        }
                        break;
                    case '<':
                        if (nTotlePoint < nCount)
                        {
                            Result = true;
                        }
                        break;
                    default:
                        if (nTotlePoint >= nCount)
                        {
                            Result = true;
                        }
                        break;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckBonusPoint");
            }
        }

        public bool ConditionOfCheckHP_CheckHigh(TPlayObject PlayObject, char cMethodMax, int nMax)
        {
            bool Result = false;
            switch (cMethodMax)
            {
                case '=':
                    if (PlayObject.m_WAbil.MaxHP == nMax)
                    {
                        Result = true;
                    }
                    break;
                case '>':
                    if (PlayObject.m_WAbil.MaxHP > nMax)
                    {
                        Result = true;
                    }
                    break;
                case '<':
                    if (PlayObject.m_WAbil.MaxHP < nMax)
                    {
                        Result = true;
                    }
                    break;
                default:
                    if (PlayObject.m_WAbil.MaxHP >= nMax)
                    {
                        Result = true;
                    }
                    break;
            }
            return Result;
        }

        private void ConditionOfCheckHP(TNormNpc NormNpc, TPlayObject PlayObject,  TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            char cMethodMin;
            char cMethodMax;
            int nMIN;
            int nMax;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                cMethodMin = QuestConditionInfo.sParam1[0];
                cMethodMax = QuestConditionInfo.sParam1[2];
                nMIN = HUtil32.Str_ToInt(QuestConditionInfo.sParam2, -1);
                nMax = HUtil32.Str_ToInt(QuestConditionInfo.sParam4, -1);
                if ((nMIN < 0) || (nMax < 0))
                {
                    ScriptConditionError(NormNpc, PlayObject, QuestConditionInfo, M2Share.sSC_CHECKHP);
                    return;
                }
                switch (cMethodMin)
                {
                    case '=':
                        if ((PlayObject.m_WAbil.HP == nMIN))
                        {
                            Result = ConditionOfCheckHP_CheckHigh(PlayObject, cMethodMax, nMax);
                        }
                        break;
                    case '>':
                        if ((PlayObject.m_WAbil.HP > nMIN))
                        {
                            Result = ConditionOfCheckHP_CheckHigh(PlayObject, cMethodMax, nMax);
                        }
                        break;
                    case '<':
                        if ((PlayObject.m_WAbil.HP < nMIN))
                        {
                            Result = ConditionOfCheckHP_CheckHigh(PlayObject, cMethodMax, nMax);
                        }
                        break;
                    default:
                        if ((PlayObject.m_WAbil.HP >= nMIN))
                        {
                            Result = ConditionOfCheckHP_CheckHigh(PlayObject, cMethodMax, nMax);
                        }
                        break;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckHP");
            }
        }

        public bool ConditionOfCheckMP_CheckHigh(TPlayObject PlayObject, char cMethodMax, int nMax)
        {
            bool result = false;
            switch (cMethodMax)
            {
                case '=':
                    if (PlayObject.m_WAbil.MaxMP == nMax)
                    {
                        result = true;
                    }
                    break;
                case '>':
                    if (PlayObject.m_WAbil.MaxMP > nMax)
                    {
                        result = true;
                    }
                    break;
                case '<':
                    if (PlayObject.m_WAbil.MaxMP < nMax)
                    {
                        result = true;
                    }
                    break;
                default:
                    if (PlayObject.m_WAbil.MaxMP >= nMax)
                    {
                        result = true;
                    }
                    break;
            }
            return result;
        }

        private void ConditionOfCheckMP(TNormNpc NormNpc, TPlayObject PlayObject,  TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            char cMethodMin;
            char cMethodMax;
            int nMIN;
            int nMax;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                cMethodMin = QuestConditionInfo.sParam1[0];
                cMethodMax = QuestConditionInfo.sParam1[2];
                nMIN = HUtil32.Str_ToInt(QuestConditionInfo.sParam2, -1);
                nMax = HUtil32.Str_ToInt(QuestConditionInfo.sParam4, -1);
                if ((nMIN < 0) || (nMax < 0))
                {
                    ScriptConditionError(NormNpc,PlayObject, QuestConditionInfo, M2Share.sSC_CHECKMP);
                    return;
                }
                switch (cMethodMin)
                {
                    case '=':
                        if ((PlayObject.m_WAbil.MP == nMIN))
                        {
                            Result = ConditionOfCheckMP_CheckHigh(PlayObject, cMethodMax, nMax);
                        }
                        break;
                    case '>':
                        if ((PlayObject.m_WAbil.MP > nMIN))
                        {
                            Result = ConditionOfCheckMP_CheckHigh(PlayObject, cMethodMax, nMax);
                        }
                        break;
                    case '<':
                        if ((PlayObject.m_WAbil.MP < nMIN))
                        {
                            Result = ConditionOfCheckMP_CheckHigh(PlayObject, cMethodMax, nMax);
                        }
                        break;
                    default:
                        if ((PlayObject.m_WAbil.MP >= nMIN))
                        {
                            Result = ConditionOfCheckMP_CheckHigh(PlayObject, cMethodMax, nMax);
                        }
                        break;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckMP");
            }
        }

        public bool ConditionOfCheckDC_CheckHigh(TPlayObject PlayObject, char cMethodMax, int nMax)
        {
            bool result = false;
            switch (cMethodMax)
            {
                case '=':

                    if (HUtil32.HiWord(PlayObject.m_WAbil.DC) == nMax)
                    {
                        result = true;
                    }
                    break;
                case '>':

                    if (HUtil32.HiWord(PlayObject.m_WAbil.DC) > nMax)
                    {
                        result = true;
                    }
                    break;
                case '<':

                    if (HUtil32.HiWord(PlayObject.m_WAbil.DC) < nMax)
                    {
                        result = true;
                    }
                    break;
                default:

                    if (HUtil32.HiWord(PlayObject.m_WAbil.DC) >= nMax)
                    {
                        result = true;
                    }
                    break;
            }
            return result;
        }

        private void ConditionOfCheckDC(TNormNpc NormNpc, TPlayObject PlayObject,  TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            char cMethodMin;
            char cMethodMax;
            int nMIN;
            int nMax;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                cMethodMin = QuestConditionInfo.sParam1[0];
                cMethodMax = QuestConditionInfo.sParam1[2];
                nMIN = HUtil32.Str_ToInt(QuestConditionInfo.sParam2, -1);
                nMax = HUtil32.Str_ToInt(QuestConditionInfo.sParam4, -1);
                if ((nMIN < 0) || (nMax < 0))
                {
                    ScriptConditionError(NormNpc,PlayObject, QuestConditionInfo, M2Share.sSC_CHECKDC);
                    return;
                }
                switch (cMethodMin)
                {
                    case '=':

                        if ((HUtil32.LoWord(PlayObject.m_WAbil.DC) == nMIN))
                        {
                            Result = ConditionOfCheckDC_CheckHigh(PlayObject, cMethodMax, nMax);
                        }
                        break;
                    case '>':

                        if ((HUtil32.LoWord(PlayObject.m_WAbil.DC) > nMIN))
                        {
                            Result = ConditionOfCheckDC_CheckHigh(PlayObject, cMethodMax, nMax);
                        }
                        break;
                    case '<':

                        if ((HUtil32.LoWord(PlayObject.m_WAbil.DC) < nMIN))
                        {
                            Result = ConditionOfCheckDC_CheckHigh(PlayObject, cMethodMax, nMax);
                        }
                        break;
                    default:

                        if ((HUtil32.LoWord(PlayObject.m_WAbil.DC) >= nMIN))
                        {
                            Result = ConditionOfCheckDC_CheckHigh(PlayObject, cMethodMax, nMax);
                        }
                        break;
                }
                Result = false;
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckDC");
            }
            Result = false;
        }

        public bool ConditionOfCheckMC_CheckHigh(TPlayObject PlayObject, char cMethodMax, int nMax)
        {
            bool result = false;
            switch (cMethodMax)
            {
                case '=':
                    if (HUtil32.HiWord(PlayObject.m_WAbil.MC) == nMax)
                    {
                        result = true;
                    }
                    break;
                case '>':
                    if (HUtil32.HiWord(PlayObject.m_WAbil.MC) > nMax)
                    {
                        result = true;
                    }
                    break;
                case '<':
                    if (HUtil32.HiWord(PlayObject.m_WAbil.MC) < nMax)
                    {
                        result = true;
                    }
                    break;
                default:
                    if (HUtil32.HiWord(PlayObject.m_WAbil.MC) >= nMax)
                    {
                        result = true;
                    }
                    break;
            }
            return result;
        }

        private void ConditionOfCheckMC(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            char cMethodMin;
            char cMethodMax;
            int nMIN;
            int nMax;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                cMethodMin = QuestConditionInfo.sParam1[0];
                cMethodMax = QuestConditionInfo.sParam1[2];
                nMIN = HUtil32.Str_ToInt(QuestConditionInfo.sParam2, -1);
                nMax = HUtil32.Str_ToInt(QuestConditionInfo.sParam4, -1);
                if ((nMIN < 0) || (nMax < 0))
                {
                    ScriptConditionError(NormNpc,PlayObject, QuestConditionInfo, M2Share.sSC_CHECKMC);
                    return;
                }
                switch (cMethodMin)
                {
                    case '=':
                        if ((HUtil32.LoWord(PlayObject.m_WAbil.MC) == nMIN))
                        {
                            Result = ConditionOfCheckMC_CheckHigh(PlayObject, cMethodMax, nMax);
                        }
                        break;
                    case '>':
                        if ((HUtil32.LoWord(PlayObject.m_WAbil.MC) > nMIN))
                        {
                            Result = ConditionOfCheckMC_CheckHigh(PlayObject, cMethodMax, nMax);
                        }
                        break;
                    case '<':
                        if ((HUtil32.LoWord(PlayObject.m_WAbil.MC) < nMIN))
                        {
                            Result = ConditionOfCheckMC_CheckHigh(PlayObject, cMethodMax, nMax);
                        }
                        break;
                    default:
                        if ((HUtil32.LoWord(PlayObject.m_WAbil.MC) >= nMIN))
                        {
                            Result = ConditionOfCheckMC_CheckHigh(PlayObject, cMethodMax, nMax);
                        }
                        break;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckMC");
            }
        }

        public bool ConditionOfCheckSC_CheckHigh(TPlayObject PlayObject, char cMethodMax, int nMax)
        {
            bool result = false;
            switch (cMethodMax)
            {
                case '=':

                    if (HUtil32.HiWord(PlayObject.m_WAbil.SC) == nMax)
                    {
                        result = true;
                    }
                    break;
                case '>':

                    if (HUtil32.HiWord(PlayObject.m_WAbil.SC) > nMax)
                    {
                        result = true;
                    }
                    break;
                case '<':

                    if (HUtil32.HiWord(PlayObject.m_WAbil.SC) < nMax)
                    {
                        result = true;
                    }
                    break;
                default:

                    if (HUtil32.HiWord(PlayObject.m_WAbil.SC) >= nMax)
                    {
                        result = true;
                    }
                    break;
            }
            return result;
        }

        private void ConditionOfCheckSC(TNormNpc NormNpc, TPlayObject PlayObject,  TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            char cMethodMin;
            char cMethodMax;
            int nMIN;
            int nMax;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                cMethodMin = QuestConditionInfo.sParam1[0];
                cMethodMax = QuestConditionInfo.sParam1[2];
                nMIN = HUtil32.Str_ToInt(QuestConditionInfo.sParam2, -1);
                nMax = HUtil32.Str_ToInt(QuestConditionInfo.sParam4, -1);
                if ((nMIN < 0) || (nMax < 0))
                {
                    ScriptConditionError(NormNpc,PlayObject, QuestConditionInfo, M2Share.sSC_CHECKSC);
                    return;
                }
                switch (cMethodMin)
                {
                    case '=':

                        if ((HUtil32.LoWord(PlayObject.m_WAbil.SC) == nMIN))
                        {
                            Result = ConditionOfCheckSC_CheckHigh(PlayObject, cMethodMax, nMax);
                        }
                        break;
                    case '>':

                        if ((HUtil32.LoWord(PlayObject.m_WAbil.SC) > nMIN))
                        {
                            Result = ConditionOfCheckSC_CheckHigh(PlayObject, cMethodMax, nMax);
                        }
                        break;
                    case '<':

                        if ((HUtil32.LoWord(PlayObject.m_WAbil.SC) < nMIN))
                        {
                            Result = ConditionOfCheckSC_CheckHigh(PlayObject, cMethodMax, nMax);
                        }
                        break;
                    default:

                        if ((HUtil32.LoWord(PlayObject.m_WAbil.SC) >= nMIN))
                        {
                            Result = ConditionOfCheckSC_CheckHigh(PlayObject, cMethodMax, nMax);
                        }
                        break;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckSC");
            }
        }

        private void ConditionOfCheckFlourishPoint(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            char cMethod;
            int nPoint;
            TGUild Guild;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                nPoint = HUtil32.Str_ToInt(QuestConditionInfo.sParam2, -1);
                if (nPoint < 0)
                {
                    if (!GetValValue(PlayObject, QuestConditionInfo.sParam2, ref nPoint))
                    {
                        // 增加变量支持
                        ScriptConditionError(NormNpc, PlayObject, QuestConditionInfo, M2Share.sSC_CHECKFLOURISHPOINT);
                        return;
                    }
                }
                if (PlayObject.m_MyGuild == null)
                {
                    return;
                }
                Guild = PlayObject.m_MyGuild;
                cMethod = QuestConditionInfo.sParam1[0];
                switch (cMethod)
                {
                    case '=':
                        if (Guild.nFlourishing == nPoint)
                        {
                            Result = true;
                        }
                        break;
                    case '>':
                        if (Guild.nFlourishing > nPoint)
                        {
                            Result = true;
                        }
                        break;
                    case '<':
                        if (Guild.nFlourishing < nPoint)
                        {
                            Result = true;
                        }
                        break;
                    default:
                        if (Guild.nFlourishing >= nPoint)
                        {
                            Result = true;
                        }
                        break;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckFlourishPoint");
            }
        }

        private void ConditionOfCheckChiefItemCount(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            char cMethod;
            int nCount;
            TGUild Guild;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                nCount = HUtil32.Str_ToInt(QuestConditionInfo.sParam2, -1);
                if (nCount < 0)
                {
                    ScriptConditionError(NormNpc,PlayObject, QuestConditionInfo, M2Share.sSC_CHECKFLOURISHPOINT);
                    return;
                }
                if (PlayObject.m_MyGuild == null)
                {
                    return;
                }
                Guild = PlayObject.m_MyGuild;
                cMethod = QuestConditionInfo.sParam1[0];
                switch (cMethod)
                {
                    case '=':
                        if (Guild.nChiefItemCount == nCount)
                        {
                            Result = true;
                        }
                        break;
                    case '>':
                        if (Guild.nChiefItemCount > nCount)
                        {
                            Result = true;
                        }
                        break;
                    case '<':
                        if (Guild.nChiefItemCount < nCount)
                        {
                            Result = true;
                        }
                        break;
                    default:
                        if (Guild.nChiefItemCount >= nCount)
                        {
                            Result = true;
                        }
                        break;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckChiefItemCount");
            }
        }

        private void ConditionOfCheckGuildAuraePoint(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            char cMethod;
            int nPoint;
            TGUild Guild;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                nPoint = HUtil32.Str_ToInt(QuestConditionInfo.sParam2, -1);
                if (nPoint < 0)
                {
                    if (!GetValValue(PlayObject, QuestConditionInfo.sParam2, ref nPoint))
                    {
                        // 增加变量支持
                        ScriptConditionError(NormNpc,PlayObject, QuestConditionInfo, M2Share.sSC_CHECKAURAEPOINT);
                        return;
                    }
                }
                if (PlayObject.m_MyGuild == null)
                {
                    return;
                }
                Guild = PlayObject.m_MyGuild;
                cMethod = QuestConditionInfo.sParam1[0];
                switch (cMethod)
                {
                    case '=':
                        if (Guild.nAurae == nPoint)
                        {
                            Result = true;
                        }
                        break;
                    case '>':
                        if (Guild.nAurae > nPoint)
                        {
                            Result = true;
                        }
                        break;
                    case '<':
                        if (Guild.nAurae < nPoint)
                        {
                            Result = true;
                        }
                        break;
                    default:
                        if (Guild.nAurae >= nPoint)
                        {
                            Result = true;
                        }
                        break;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckGuildAuraePoint");
            }
        }

        private void ConditionOfCheckGuildBuildPoint(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            char cMethod;
            int nPoint;
            TGUild Guild;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                nPoint = HUtil32.Str_ToInt(QuestConditionInfo.sParam2, -1);
                if (nPoint < 0)
                {
                    if (!GetValValue(PlayObject, QuestConditionInfo.sParam2, ref nPoint))
                    {
                        ScriptConditionError(NormNpc,PlayObject, QuestConditionInfo, M2Share.sSC_CHECKBUILDPOINT);
                        return;
                    }
                }
                if (PlayObject.m_MyGuild == null)
                {
                    return;
                }
                Guild = PlayObject.m_MyGuild;
                cMethod = QuestConditionInfo.sParam1[0];
                switch (cMethod)
                {
                    case '=':
                        if (Guild.nBuildPoint == nPoint)
                        {
                            Result = true;
                        }
                        break;
                    case '>':
                        if (Guild.nBuildPoint > nPoint)
                        {
                            Result = true;
                        }
                        break;
                    case '<':
                        if (Guild.nBuildPoint < nPoint)
                        {
                            Result = true;
                        }
                        break;
                    default:
                        if (Guild.nBuildPoint >= nPoint)
                        {
                            Result = true;
                        }
                        break;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckGuildBuildPoint");
            }
        }

        private void ConditionOfCheckStabilityPoint(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            char cMethod;
            int nPoint;
            TGUild Guild;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                nPoint = HUtil32.Str_ToInt(QuestConditionInfo.sParam2, -1);
                if (nPoint < 0)
                {
                    if (!GetValValue(PlayObject, QuestConditionInfo.sParam2, ref nPoint))
                    {
                        ScriptConditionError(NormNpc,PlayObject, QuestConditionInfo, M2Share.sSC_CHECKSTABILITYPOINT);
                        return;
                    }
                }
                if (PlayObject.m_MyGuild == null)
                {
                    return;
                }
                Guild = PlayObject.m_MyGuild;
                cMethod = QuestConditionInfo.sParam1[0];
                switch (cMethod)
                {
                    case '=':
                        if (Guild.nStability == nPoint)
                        {
                            Result = true;
                        }
                        break;
                    case '>':
                        if (Guild.nStability > nPoint)
                        {
                            Result = true;
                        }
                        break;
                    case '<':
                        if (Guild.nStability < nPoint)
                        {
                            Result = true;
                        }
                        break;
                    default:
                        if (Guild.nStability >= nPoint)
                        {
                            Result = true;
                        }
                        break;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckStabilityPoint");
            }
        }

        private void ConditionOfCheckGameGold(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            char cMethod;
            int nGameGold;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                nGameGold = HUtil32.Str_ToInt(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam2), -1);
                if (nGameGold < 0)
                {
                    if (!GetValValue(PlayObject, QuestConditionInfo.sParam2, ref nGameGold))
                    {
                        ScriptConditionError(NormNpc, PlayObject, QuestConditionInfo, M2Share.sSC_CHECKGAMEGOLD);
                        return;
                    }
                }
                cMethod = QuestConditionInfo.sParam1[0];
                switch (cMethod)
                {
                    case '=':
                        if (PlayObject.m_nGameGold == nGameGold)
                        {
                            Result = true;
                        }
                        break;
                    case '>':
                        if (PlayObject.m_nGameGold > nGameGold)
                        {
                            Result = true;
                        }
                        break;
                    case '<':
                        if (PlayObject.m_nGameGold < nGameGold)
                        {
                            Result = true;
                        }
                        break;
                    default:
                        if (PlayObject.m_nGameGold >= nGameGold)
                        {
                            Result = true;
                        }
                        break;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckGameGold");
            }
        }

        private void ConditionOfCheckGamePoint(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            char cMethod;
            int nGamePoint;
            Result = false;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                nGamePoint = HUtil32.Str_ToInt(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam2), -1);
                if (nGamePoint < 0)
                {
                    nGamePoint = QuestConditionInfo.nParam2;
                }
                if (nGamePoint < 0)
                {
                    if (!GetValValue(PlayObject, QuestConditionInfo.sParam2, ref nGamePoint))
                    {
                        ScriptConditionError(NormNpc, PlayObject, QuestConditionInfo, M2Share.sSC_CHECKGAMEPOINT);
                        return;
                    }
                }
                cMethod = QuestConditionInfo.sParam1[0];
                switch (cMethod)
                {
                    case '=':
                        if (PlayObject.m_nGamePoint == nGamePoint)
                        {
                            Result = true;
                        }
                        break;
                    case '>':
                        if (PlayObject.m_nGamePoint > nGamePoint)
                        {
                            Result = true;
                        }
                        break;
                    case '<':
                        if (PlayObject.m_nGamePoint < nGamePoint)
                        {
                            Result = true;
                        }
                        break;
                    default:
                        if (PlayObject.m_nGamePoint >= nGamePoint)
                        {
                            Result = true;
                        }
                        break;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckGamePoint");
            }
        }

        private void ConditionOfCheckGroupCount(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            char cMethod;
            int nCount;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                if (PlayObject.m_GroupOwner == null)
                {
                    return;
                }
                nCount = HUtil32.Str_ToInt(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam2), -1);
                if (nCount < 0)
                {
                    if (!GetValValue(PlayObject, QuestConditionInfo.sParam2, ref nCount))
                    {
                        ScriptConditionError(NormNpc, PlayObject, QuestConditionInfo, M2Share.sSC_CHECKGROUPCOUNT);
                        return;
                    }
                }
                cMethod = QuestConditionInfo.sParam1[0];
                switch (cMethod)
                {
                    case '=':
                        if (PlayObject.m_GroupOwner.m_GroupMembers.Count == nCount)
                        {
                            Result = true;
                        }
                        break;
                    case '>':
                        if (PlayObject.m_GroupOwner.m_GroupMembers.Count > nCount)
                        {
                            Result = true;
                        }
                        break;
                    case '<':
                        if (PlayObject.m_GroupOwner.m_GroupMembers.Count < nCount)
                        {
                            Result = true;
                        }
                        break;
                    default:
                        if (PlayObject.m_GroupOwner.m_GroupMembers.Count >= nCount)
                        {
                            Result = true;
                        }
                        break;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckGroupCount");
            }
        }

        private void ConditionOfCheckHaveGuild(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = PlayObject.m_MyGuild != null;// 更正检查结果反了
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckHaveGuild");
            }
        }

        private void ConditionOfCheckIsAttackGuild(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                if (PlayObject.m_Castle == null)
                {
                    ScriptConditionError(NormNpc, PlayObject, QuestConditionInfo, M2Share.sSC_ISATTACKGUILD);
                    return;
                }
                if (PlayObject.m_MyGuild == null)
                {
                    return;
                }
                Result = PlayObject.m_Castle.IsAttackGuild(PlayObject.m_MyGuild);
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckIsAttackGuild");
            }
        }

        /// <summary>
        /// 检查上次攻城到现在的天数
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <param name="Result"></param>
        /// <returns></returns>
        private void ConditionOfCheckCastleWarDay(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            int nDay;
            char cMethod;
            int nWarDay;
            try
            {
                Result = false;
                nDay = HUtil32.Str_ToInt(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam2), -1);
                if (nDay < 0)
                {
                    GetValValue(PlayObject, QuestConditionInfo.sParam2, ref nDay);// 增加变量支持
                }
                if ((nDay < 0) || (NormNpc.m_Castle == null))
                {
                    ScriptConditionError(NormNpc, PlayObject, QuestConditionInfo, M2Share.sSC_CASTLEWARDAY);
                    return;
                }
                nWarDay = HUtil32.GetDayCount(DateTime.Now, NormNpc.m_Castle.m_WarDate);
                cMethod = QuestConditionInfo.sParam1[0];
                switch (cMethod)
                {
                    case '=':
                        if (nWarDay == nDay)
                        {
                            Result = true;
                        }
                        break;
                    case '>':
                        if (nWarDay > nDay)
                        {
                            Result = true;
                        }
                        break;
                    case '<':
                        if (nWarDay < nDay)
                        {
                            Result = true;
                        }
                        break;
                    default:
                        if (nWarDay >= nDay)
                        {
                            Result = true;
                        }
                        break;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckCastleWarDay");
            }
        }

        /// <summary>
        /// 检查沙巴克城门状态
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <param name="Result"></param>
        /// <returns></returns>
        private void ConditionOfCheckCastleDoorStatus(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            Result = false;
            int nDay;
            int nDoorStatus;
            TCastleDoor CastleDoor;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                nDay = HUtil32.Str_ToInt(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam2), -1);
                if (nDay < 0)
                {
                    GetValValue(PlayObject, QuestConditionInfo.sParam2, ref nDay);// 增加变量支持
                }
                nDoorStatus = -1;
                if ((QuestConditionInfo.sParam1).ToLower().CompareTo(("损坏").ToLower()) == 0)
                {
                    nDoorStatus = 0;
                }
                if ((QuestConditionInfo.sParam1).ToLower().CompareTo(("开启").ToLower()) == 0)
                {
                    nDoorStatus = 1;
                }
                if ((QuestConditionInfo.sParam1).ToLower().CompareTo(("关闭").ToLower()) == 0)
                {
                    nDoorStatus = 2;
                }
                if ((nDay < 0) || (NormNpc.m_Castle == null) || (nDoorStatus < 0))
                {
                    ScriptConditionError(NormNpc, PlayObject, QuestConditionInfo, M2Share.sSC_CHECKCASTLEDOOR);
                    return;
                }
                CastleDoor = (TCastleDoor)NormNpc.m_Castle.m_MainDoor.BaseObject;
                switch (nDoorStatus)
                {
                    case 0:
                        if (CastleDoor.m_boDeath)
                        {
                            Result = true;
                        }
                        break;
                    case 1:
                        if (CastleDoor.m_boOpened)
                        {
                            Result = true;
                        }
                        break;
                    case 2:
                        if (!CastleDoor.m_boOpened)
                        {
                            Result = true;
                        }
                        break;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckCastleDoorStatus");
            }
        }

        private void ConditionOfCheckIsAttackAllyGuild(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                if (PlayObject.m_Castle == null)
                {
                    ScriptConditionError(NormNpc, PlayObject, QuestConditionInfo, M2Share.sSC_ISATTACKALLYGUILD);
                    return;
                }
                if (PlayObject.m_MyGuild == null)
                {
                    return;
                }
                Result = PlayObject.m_Castle.IsAttackAllyGuild(PlayObject.m_MyGuild);
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckIsAttackAllyGuild");
            }
        }

        /// <summary>
        /// 检查当前行会是否为守城方联盟行会
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <param name="Result"></param>
        /// <returns></returns>
        private void ConditionOfCheckIsDefenseAllyGuild(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                if (PlayObject.m_Castle == null)
                {
                    ScriptConditionError(NormNpc, PlayObject, QuestConditionInfo, M2Share.sSC_ISDEFENSEALLYGUILD);
                    return;
                }
                if (PlayObject.m_MyGuild == null)
                {
                    return;
                }
                Result = PlayObject.m_Castle.IsDefenseAllyGuild(PlayObject.m_MyGuild);
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckIsDefenseAllyGuild");
            }
        }

        /// <summary>
        /// 检查当前行会是否为守城方行会
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <param name="Result"></param>
        /// <returns></returns>
        private void ConditionOfCheckIsDefenseGuild(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                if (PlayObject.m_Castle == null)
                {
                    ScriptConditionError(NormNpc,PlayObject, QuestConditionInfo, M2Share.sSC_ISDEFENSEGUILD);
                    return;
                }
                if (PlayObject.m_MyGuild == null)
                {
                    return;
                }
                Result = PlayObject.m_Castle.IsDefenseGuild(PlayObject.m_MyGuild);
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckIsDefenseGuild");
            }
        }

        /// <summary>
        /// 检查玩家是否是行会掌门人
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <param name="Result"></param>
        /// <returns></returns>
        private void ConditionOfCheckIsGuildMaster(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            if (QuestConditionInfo.sParam6 == "88")
            {
                PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                if (PlayObject == null)
                {
                    return;
                }
            }
            Result = PlayObject.IsGuildMaster();
        }

        private void ConditionOfCheckIsMaster(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            try
            {
                Result = false;
                if ((PlayObject.m_boMaster))
                {
                    Result = true;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckIsMaster");
            }
        }

        private void ConditionOfCheckListCount(TNormNpc NormNpc, TPlayObject PlayObject,  TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
        }

        private void ConditionOfCheckItemType(TNormNpc NormNpc, TPlayObject PlayObject,  TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            int nWhere;
            int nType;
            TUserItem UserItem = null;
            TStdItem StdItem;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                nWhere = HUtil32.Str_ToInt(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam1), -1);
                nType = HUtil32.Str_ToInt(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam2), -1);
                if (nWhere < 0)
                {
                    GetValValue(PlayObject, QuestConditionInfo.sParam1, ref nWhere);// 增加变量支持
                }
                if (nType < 0)
                {
                    GetValValue(PlayObject, QuestConditionInfo.sParam2, ref nType);// 增加变量支持
                }
                if (!(nWhere >= PlayObject.m_UseItems.GetLowerBound(0) && nWhere <= PlayObject.m_UseItems.GetUpperBound(0)))
                {
                    ScriptConditionError(NormNpc, PlayObject, QuestConditionInfo, M2Share.sSC_CHECKITEMTYPE);
                    return;
                }
                UserItem = PlayObject.m_UseItems[nWhere];
                if (UserItem.wIndex == 0)
                {
                    return;
                }
                StdItem = M2Share.UserEngine.GetStdItem(UserItem.wIndex);
                if ((StdItem != null) && (StdItem.StdMode == nType))
                {
                    Result = true;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckItemType");
            }
        }

        private void ConditionOfCheckLevelEx(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            int nLevel;
            char cMethod;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                nLevel = HUtil32.Str_ToInt(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam2), -1);
                if (nLevel < 0)
                {
                    if (!GetValValue(PlayObject, QuestConditionInfo.sParam2, ref nLevel))
                    {
                        ScriptConditionError(NormNpc, PlayObject, QuestConditionInfo, M2Share.sSC_CHECKLEVELEX);
                        return;
                    }
                }
                cMethod = QuestConditionInfo.sParam1[0];
                switch (cMethod)
                {
                    case '=':
                        if (PlayObject.m_Abil.Level == nLevel)
                        {
                            Result = true;
                        }
                        break;
                    case '>':
                        if (PlayObject.m_Abil.Level > nLevel)
                        {
                            Result = true;
                        }
                        break;
                    case '<':
                        if (PlayObject.m_Abil.Level < nLevel)
                        {
                            Result = true;
                        }
                        break;
                    default:
                        if (PlayObject.m_Abil.Level >= nLevel)
                        {
                            Result = true;
                        }
                        break;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckLevelEx");
            }
        }

        private void ConditionOfCheckMarry(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                if (PlayObject.m_sDearName != "")
                {
                    Result = true;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckMarry");
            }
        }

        private void ConditionOfCheckMarryCount(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            int nCount;
            char cMethod;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                nCount = HUtil32.Str_ToInt(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam2), -1);
                if (nCount < 0)
                {
                    if (!GetValValue(PlayObject, QuestConditionInfo.sParam2, ref nCount))// 增加变量支持
                    {
                        ScriptConditionError(NormNpc, PlayObject, QuestConditionInfo, M2Share.sSC_CHECKMARRYCOUNT);
                        return;
                    }
                }
                cMethod = QuestConditionInfo.sParam1[0];
                switch (cMethod)
                {
                    case '=':
                        if (PlayObject.m_btMarryCount == nCount)
                        {
                            Result = true;
                        }
                        break;
                    case '>':
                        if (PlayObject.m_btMarryCount > nCount)
                        {
                            Result = true;
                        }
                        break;
                    case '<':
                        if (PlayObject.m_btMarryCount < nCount)
                        {
                            Result = true;
                        }
                        break;
                    default:
                        if (PlayObject.m_btMarryCount >= nCount)
                        {
                            Result = true;
                        }
                        break;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckMarryCount");
            }
        }

        private void ConditionOfCheckMaster(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                if ((PlayObject.m_sMasterName != "") && (!PlayObject.m_boMaster))
                {
                    Result = true;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckMaster");
            }
        }

        private void ConditionOfCheckMemBerLevel(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            int nLevel;
            char cMethod;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                nLevel = HUtil32.Str_ToInt(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam2), -1);
                if (nLevel < 0)
                {
                    if (!GetValValue(PlayObject, QuestConditionInfo.sParam2, ref nLevel))
                    {
                        ScriptConditionError(NormNpc, PlayObject, QuestConditionInfo, M2Share.sSC_CHECKMEMBERLEVEL);
                        return;
                    }
                }
                cMethod = QuestConditionInfo.sParam1[0];
                switch (cMethod)
                {
                    case '=':
                        if (PlayObject.m_nMemberLevel == nLevel)
                        {
                            Result = true;
                        }
                        break;
                    case '>':
                        if (PlayObject.m_nMemberLevel > nLevel)
                        {
                            Result = true;
                        }
                        break;
                    case '<':
                        if (PlayObject.m_nMemberLevel < nLevel)
                        {
                            Result = true;
                        }
                        break;
                    default:
                        if (PlayObject.m_nMemberLevel >= nLevel)
                        {
                            Result = true;
                        }
                        break;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckMemBerLevel");
            }
        }

        private void ConditionOfCheckMemberType(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            int nType;
            char cMethod;
            try
            {
                Result = false;
                nType = HUtil32.Str_ToInt(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam2), -1);
                if (nType < 0)
                {
                    if (!GetValValue(PlayObject, QuestConditionInfo.sParam2, ref nType))
                    {
                        ScriptConditionError(NormNpc, PlayObject, QuestConditionInfo, M2Share.sSC_CHECKMEMBERTYPE);
                        return;
                    }
                }
                cMethod = QuestConditionInfo.sParam1[0];
                switch (cMethod)
                {
                    case '=':
                        if (PlayObject.m_nMemberType == nType)
                        {
                            Result = true;
                        }
                        break;
                    case '>':
                        if (PlayObject.m_nMemberType > nType)
                        {
                            Result = true;
                        }
                        break;
                    case '<':
                        if (PlayObject.m_nMemberType < nType)
                        {
                            Result = true;
                        }
                        break;
                    default:
                        if (PlayObject.m_nMemberType >= nType)
                        {
                            Result = true;
                        }
                        break;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckMemberType");
            }
        }

        /// <summary>
        /// 功能：可以检查对面人物站的位置性别（要求面对面）
        /// 格式：CHECKPOSEDIR 控制符(1,2)
        /// </summary>
        private void ConditionOfCheckPoseDir(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            TBaseObject PoseHuman;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                PoseHuman = PlayObject.GetPoseCreate();
                if ((PoseHuman != null) && (PoseHuman.GetPoseCreate() == PlayObject) && (PoseHuman.m_btRaceServer == Grobal2.RC_PLAYOBJECT))
                {
                    switch (QuestConditionInfo.nParam1)
                    {
                        case 1:// 要求相同性别
                            if (PoseHuman.m_btGender == PlayObject.m_btGender)
                            {
                                Result = true;
                            }
                            break;
                        case 2:// 要求不同性别
                            if (PoseHuman.m_btGender != PlayObject.m_btGender)
                            {
                                Result = true;
                            }
                            break;
                        default:// 无参数时不判别性别
                            Result = true;
                            break;
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckPoseDir");
            }
        }

        private void ConditionOfCheckPoseGender(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            TBaseObject PoseHuman;
            byte btSex;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                btSex = 0;
                if ((QuestConditionInfo.sParam1).ToLower().CompareTo(("MAN").ToLower()) == 0)
                {
                    btSex = 0;
                }
                else if ((QuestConditionInfo.sParam1).ToLower().CompareTo(("男").ToLower()) == 0)
                {
                    btSex = 0;
                }
                else if ((QuestConditionInfo.sParam1).ToLower().CompareTo(("WOMAN").ToLower()) == 0)
                {
                    btSex = 1;
                }
                else if ((QuestConditionInfo.sParam1).ToLower().CompareTo(("女").ToLower()) == 0)
                {
                    btSex = 1;
                }
                PoseHuman = PlayObject.GetPoseCreate();
                if ((PoseHuman != null) && (PoseHuman.m_btRaceServer == Grobal2.RC_PLAYOBJECT))
                {
                    if (PoseHuman.m_btGender == btSex)
                    {
                        Result = true;
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckPoseGender");
            }
        }

        private void ConditionOfCheckPoseIsMaster(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            TBaseObject PoseHuman;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                PoseHuman = PlayObject.GetPoseCreate();
                if ((PoseHuman != null) && (PoseHuman.m_btRaceServer == Grobal2.RC_PLAYOBJECT))
                {
                    if ((((TPlayObject)(PoseHuman)).m_sMasterName != "") && (((TPlayObject)(PoseHuman)).m_boMaster))
                    {
                        Result = true;
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckPoseIsMaster");
            }
        }

        private void ConditionOfCheckPoseLevel(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            int nLevel;
            TBaseObject PoseHuman;
            char cMethod;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                nLevel = HUtil32.Str_ToInt(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam2), -1);
                if (nLevel < 0)
                {
                    if (!GetValValue(PlayObject, QuestConditionInfo.sParam2, ref nLevel))
                    {
                        ScriptConditionError(NormNpc, PlayObject, QuestConditionInfo, M2Share.sSC_CHECKPOSELEVEL);
                        return;
                    }
                }
                cMethod = QuestConditionInfo.sParam1[0];
                PoseHuman = PlayObject.GetPoseCreate();
                if ((PoseHuman != null) && (PoseHuman.m_btRaceServer == Grobal2.RC_PLAYOBJECT))
                {
                    switch (cMethod)
                    {
                        case '=':
                            if (PoseHuman.m_Abil.Level == nLevel)
                            {
                                Result = true;
                            }
                            break;
                        case '>':
                            if (PoseHuman.m_Abil.Level > nLevel)
                            {
                                Result = true;
                            }
                            break;
                        case '<':
                            if (PoseHuman.m_Abil.Level < nLevel)
                            {
                                Result = true;
                            }
                            break;
                        default:
                            if (PoseHuman.m_Abil.Level >= nLevel)
                            {
                                Result = true;
                            }
                            break;
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckPoseLevel");
            }
        }

        private void ConditionOfCheckPoseMarry(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            TBaseObject PoseHuman;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                PoseHuman = PlayObject.GetPoseCreate();
                if ((PoseHuman != null) && (PoseHuman.m_btRaceServer == Grobal2.RC_PLAYOBJECT))
                {
                    if (((TPlayObject)(PoseHuman)).m_sDearName != "")
                    {
                        Result = true;
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckPoseMarry");
            }
        }

        private void ConditionOfCheckPoseMaster(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            TBaseObject PoseHuman;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                PoseHuman = PlayObject.GetPoseCreate();
                if ((PoseHuman != null) && (PoseHuman.m_btRaceServer == Grobal2.RC_PLAYOBJECT))
                {
                    if ((((TPlayObject)(PoseHuman)).m_sMasterName != "") && !(((TPlayObject)(PoseHuman)).m_boMaster))
                    {
                        Result = true;
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckPoseMaster");
            }
        }

        private void ConditionOfCheckServerName(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                if (QuestConditionInfo.sParam1 == M2Share.g_Config.sServerName)
                {
                    Result = true;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckServerName");
            }
        }

        private void ConditionOfCheckSlaveCount(TNormNpc NormNpc, TPlayObject PlayObject,  TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            int nCount;
            char cMethod;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                nCount = HUtil32.Str_ToInt(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam2), -1);
                if (nCount < 0)
                {
                    if (!GetValValue(PlayObject, QuestConditionInfo.sParam2, ref nCount))
                    {
                        ScriptConditionError(NormNpc, PlayObject, QuestConditionInfo, M2Share.sSC_CHECKSLAVECOUNT);
                        return;
                    }
                }
                cMethod = QuestConditionInfo.sParam1[0];
                switch (cMethod)
                {
                    case '=':
                        if (PlayObject.m_SlaveList.Count == nCount)
                        {
                            Result = true;
                        }
                        break;
                    case '>':
                        if (PlayObject.m_SlaveList.Count > nCount)
                        {
                            Result = true;
                        }
                        break;
                    case '<':
                        if (PlayObject.m_SlaveList.Count < nCount)
                        {
                            Result = true;
                        }
                        break;
                    default:
                        if (PlayObject.m_SlaveList.Count >= nCount)
                        {
                            Result = true;
                        }
                        break;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckSlaveCount");
            }
        }

        /// <summary>
        /// 检查人物是否在安全区域内
        /// </summary>
        /// <param name="BaseObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <param name="Result"></param>
        private void ConditionOfCheckSafeZone(TNormNpc NormNpc, TPlayObject PlayObject,  TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = PlayObject.InSafeZone();
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckSafeZone");
            }
        }

        private void ConditionOfCheckMapName(TNormNpc NormNpc, TPlayObject PlayObject,  TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            string sCharName;
            string sMapName;
            TPlayObject OnlinePlayObject;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                if ((QuestConditionInfo.sParam1).ToLower().CompareTo(("Self").ToLower()) == 0)
                {
                    sCharName = PlayObject.m_sCharName;
                }
                else
                {
                    sCharName = GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam1);
                }
                sMapName = GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam2);
                if (sCharName == PlayObject.m_sCharName)
                {
                    if (sMapName == PlayObject.m_sMapName)
                    {
                        Result = true;
                    }
                }
                else
                {
                    OnlinePlayObject = M2Share.UserEngine.GetPlayObject(sCharName);
                    if (OnlinePlayObject != null)
                    {
                        if (OnlinePlayObject.m_sMapName == sMapName)
                        {
                            Result = true;
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckMapName");
            }
        }

        /// <summary>
        /// 功能：检查人物技能等级
        /// CHECKSKILL 技能名称 控制符(=,>,<)  修炼等级
        /// </summary>
        /// <returns></returns>
        private void ConditionOfCheckSkill(TNormNpc NormNpc, TPlayObject PlayObject,  TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            int nSkillLevel;
            char cMethod;
            TUserMagic UserMagic;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                nSkillLevel = HUtil32.Str_ToInt(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam3), -1);
                if (nSkillLevel < 0)
                {
                    if (!GetValValue(PlayObject, QuestConditionInfo.sParam3, ref nSkillLevel))
                    {
                        ScriptConditionError(NormNpc, PlayObject, QuestConditionInfo, M2Share.sCHECKSKILL);
                        return;
                    }
                }
                UserMagic = null;
                UserMagic = PlayObject.GetMagicInfo(QuestConditionInfo.sParam1);
                if (UserMagic == null)
                {
                    return;
                }
                cMethod = QuestConditionInfo.sParam2[1];
                switch (cMethod)
                {
                    case '=':
                        if (UserMagic.btLevel == nSkillLevel)
                        {
                            Result = true;
                        }
                        break;
                    case '>':
                        if (UserMagic.btLevel > nSkillLevel)
                        {
                            Result = true;
                        }
                        break;
                    case '<':
                        if (UserMagic.btLevel < nSkillLevel)
                        {
                            Result = true;
                        }
                        break;
                    default:
                        if (UserMagic.btLevel >= nSkillLevel)
                        {
                            Result = true;
                        }
                        break;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckSkill");
            }
        }

        private void ConditionOfAnsiContainsText(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            string sValue1;
            string sValue2;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                sValue1 = GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam1);
                sValue2 = GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam2);
                if ((sValue1.IndexOf(sValue2) != -1))
                {
                    Result = true;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfAnsiContainsText");
            }
        }

        private void ConditionOfCompareText(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            string sValue1 = string.Empty;
            string sValue2 = string.Empty;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                GetValValue(PlayObject, QuestConditionInfo.sParam1, ref sValue1);
                GetValValue(PlayObject, QuestConditionInfo.sParam2, ref sValue2);
                sValue1 = GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam1);
                sValue2 = GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam2);
                if (string.Compare(sValue1, sValue2, true) == 0)
                {
                    Result = true;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCompareText");
            }
        }

        private void ConditionOfCheckStationTime(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            int nCount;
            char cMethod;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                nCount = HUtil32.Str_ToInt(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam2), -1);
                if (nCount < 0)
                {
                    if (!GetValValue(PlayObject, QuestConditionInfo.sParam2, ref nCount))
                    {
                        ScriptConditionError(NormNpc, PlayObject, QuestConditionInfo, M2Share.sSC_CHECKSTATIONTIME);
                        return;
                    }
                }
                nCount = nCount * 60000;// 60 * 1000
                cMethod = QuestConditionInfo.sParam1[0];
                switch (cMethod)
                {
                    case '=':
                        if (HUtil32.GetTickCount() - PlayObject.m_dwStationTick == nCount)
                        {
                            Result = true;
                        }
                        break;
                    case '>':
                        if (HUtil32.GetTickCount() - PlayObject.m_dwStationTick > nCount)
                        {
                            Result = true;
                        }
                        break;
                    case '<':
                        if (HUtil32.GetTickCount() - PlayObject.m_dwStationTick < nCount)
                        {
                            Result = true;
                        }
                        break;
                    default:
                        if (HUtil32.GetTickCount() - PlayObject.m_dwStationTick >= nCount)
                        {
                            Result = true;
                        }
                        break;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckStationTime");
            }
        }

        private void ConditionOfCheckPKPoint(TNormNpc NormNpc, TPlayObject PlayObject,  TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            int nPKPOINT;
            char cMethod;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                nPKPOINT = HUtil32.Str_ToInt(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam2), -1);
                if (nPKPOINT < 0)
                {
                    if (!GetValValue(PlayObject, QuestConditionInfo.sParam2, ref nPKPOINT))
                    {
                        ScriptConditionError(NormNpc,PlayObject, QuestConditionInfo, M2Share.sCHECKPKPOINT);
                        return;
                    }
                }
                cMethod = QuestConditionInfo.sParam1[0];
                switch (cMethod)
                {
                    case '=':
                        if (PlayObject.m_nPkPoint == nPKPOINT)
                        {
                            Result = true;
                        }
                        break;
                    case '>':
                        if (PlayObject.m_nPkPoint > nPKPOINT)
                        {
                            Result = true;
                        }
                        break;
                    case '<':
                        if (PlayObject.m_nPkPoint < nPKPOINT)
                        {
                            Result = true;
                        }
                        break;
                    default:
                        if (PlayObject.m_nPkPoint >= nPKPOINT)
                        {
                            Result = true;
                        }
                        break;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCHECKPKPOINT");
            }
        }

        private void ConditionOfIsUnderWar(TNormNpc NormNpc, TPlayObject PlayObject,  TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            TUserCastle UserCastle;
            string sCastleName = QuestConditionInfo.sParam1;
            if (sCastleName != "")
            {
                HUtil32.EnterCriticalSection(M2Share.ProcessMsgCriticalSection);
                try
                {
                    for (int i = 0; i < M2Share.g_CastleManager.m_CastleList.Count; i++)
                    {
                        UserCastle = M2Share.g_CastleManager.m_CastleList[i];
                        if ((UserCastle.m_sName).ToLower().CompareTo((sCastleName).ToLower()) == 0)
                        {
                            Result = UserCastle.m_boUnderWar;
                            break;
                        }
                    }
                }
                finally
                {
                    HUtil32.LeaveCriticalSection(M2Share.ProcessMsgCriticalSection);
                }
            }
        }

        private void ConditionOfInCastleWarArea(TNormNpc NormNpc, TPlayObject PlayObject,  TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            TUserCastle Castle;
            HUtil32.EnterCriticalSection(M2Share.ProcessMsgCriticalSection);
            try
            {
                Castle = M2Share.g_CastleManager.InCastleWarArea(PlayObject.m_PEnvir, PlayObject.m_nCurrX, PlayObject.m_nCurrY);
                Result = (Castle != null);
            }
            finally
            {
                HUtil32.LeaveCriticalSection(M2Share.ProcessMsgCriticalSection);
            }
        }

        /// <summary>
        /// 检查指定变量是否大于指定参数
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <param name="Result"></param>
        private void ConditionOfLapge(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            int n14 = 0;
            int n18 = 0;
            if (CheckVarNameNo(NormNpc, PlayObject, QuestConditionInfo, ref n14, ref n18))
            {
                if (n14 <= n18)
                {
                    Result = false;
                }
            }
            else
            {
                Result = false;
            }
        }

        /// <summary>
        /// 检查指定变量是否小于指定参数
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <param name="Result"></param>
        private void ConditionOfSmall(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            int n14 = 0;
            int n18 = 0;
            if (CheckVarNameNo(NormNpc, PlayObject, QuestConditionInfo, ref n14, ref n18))
            {
                if (n14 >= n18)
                {
                    Result = false;
                }
            }
            else
            {
                Result = false;
            }
        }

        /// <summary>
        /// 检查玩家权限是否大于4
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <param name="Result"></param>
        private void ConditionOfISSYSOP(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = true;
            if (!(PlayObject.m_btPermission >= 4))
            {
                Result = false;
            }
        }

        /// <summary>
        /// 检查玩家权限是否大于6
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <param name="Result"></param>
        private void ConditionOfISAdmin(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = true;
            if (!(PlayObject.m_btPermission >= 6))
            {
                Result = false;
            }
        }

        /// <summary>
        /// 检查小时是否相等
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <param name="Result"></param>
        private void ConditionOfHour(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = true;
            if ((QuestConditionInfo.nParam1 != 0) && (QuestConditionInfo.nParam2 == 0))
            {
                QuestConditionInfo.nParam2 = QuestConditionInfo.nParam1;
            }
            int Hour = DateTime.Now.Hour;
            int Min = DateTime.Now.Minute;
            int Sec = DateTime.Now.Second;
            int MSec = DateTime.Now.Millisecond;
            if ((Hour < QuestConditionInfo.nParam1) || (Hour > QuestConditionInfo.nParam2))
            {
                Result = false;
            }
        }

        /// <summary>
        /// 检查分钟是否相等
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <param name="Result"></param>
        private void ConditionOfMin(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = true;
            if ((QuestConditionInfo.nParam1 != 0) && (QuestConditionInfo.nParam2 == 0))
            {
                QuestConditionInfo.nParam2 = QuestConditionInfo.nParam1;
            }
            int Hour = DateTime.Now.Hour;
            int Min = DateTime.Now.Minute;
            int Sec = DateTime.Now.Second;
            int MSec = DateTime.Now.Millisecond;
            if ((Min < QuestConditionInfo.nParam1) || (Min > QuestConditionInfo.nParam2))
            {
                Result = false;
            }
        }

        /// <summary>
        /// 检查日期是否相等
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <param name="Result"></param>
        private void ConditionOfDayOfWeek(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            if (HUtil32.CompareLStr(QuestConditionInfo.sParam1, "SUN", 3))
            {
                if (DateTime.Now.DayOfWeek.ToString() != "1")
                {
                    Result = false;
                }
            }
            if (HUtil32.CompareLStr(QuestConditionInfo.sParam1, "MON", 3))
            {
                if (DateTime.Now.DayOfWeek.ToString() != "2")
                {
                    Result = false;
                }
            }
            if (HUtil32.CompareLStr(QuestConditionInfo.sParam1, "TUE", 3))
            {
                if (DateTime.Now.DayOfWeek.ToString() != "3")
                {
                    Result = false;
                }
            }
            if (HUtil32.CompareLStr(QuestConditionInfo.sParam1, "WED", 3))
            {
                if (DateTime.Now.DayOfWeek.ToString() != "4")
                {
                    Result = false;
                }
            }
            if (HUtil32.CompareLStr(QuestConditionInfo.sParam1, "THU", 3))
            {
                if (DateTime.Now.DayOfWeek.ToString() != "5")
                {
                    Result = false;
                }
            }
            if (HUtil32.CompareLStr(QuestConditionInfo.sParam1, "FRI", 3))
            {
                if (DateTime.Now.DayOfWeek.ToString() != "6")
                {
                    Result = false;
                }
            }
            if (HUtil32.CompareLStr(QuestConditionInfo.sParam1, "SAT", 3))
            {
                if (DateTime.Now.DayOfWeek.ToString() != "7")
                {
                    Result = false;
                }
            }
        }

        /// <summary>
        /// 检查物品持久
        /// </summary>
        protected void ConditionOfCheckDura(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = true;
            int n1C = 0;
            int nMaxDura = 0;
            int nDura = 0;
            var UserItem = PlayObject.QuestCheckItem(QuestConditionInfo.sParam1, ref n1C, ref nMaxDura, ref nDura);
            if (Convert.ToInt32(HUtil32.Round((double)nDura / 1000)) < QuestConditionInfo.nParam2)
            {
                Result = false;
            }
        }

        /// <summary>
        /// 检查游戏物品
        /// </summary>
        private void ConditionOfCheckItem(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            TUserItem UserItem = null;
            var s01 = GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam1);
            var n14 = HUtil32.Str_ToInt(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam2), 0);
            int n1C = 0;
            int nMaxDura = 0;
            int nDura = 0;
            if ((QuestConditionInfo.sParam3).ToLower().CompareTo(("HERO").ToLower()) == 0)
            {
                if (PlayObject.m_MyHero != null)
                {
                    UserItem = ((THeroObject)(PlayObject.m_MyHero)).QuestCheckItem(s01, ref n1C, ref nMaxDura, ref nDura);
                }
            }
            else
            {
                UserItem = PlayObject.QuestCheckItem(s01, ref n1C, ref nMaxDura, ref nDura);
            }
            if (n1C < n14)
            {
                Result = false;
            }
        }

        /// <summary>
        /// 检查玩家职业
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <param name="Result"></param>
        private void ConditionOfCheckJob(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            if (HUtil32.CompareLStr(QuestConditionInfo.sParam1, "WARRIOR", 3))
            {
                if (PlayObject.m_btJob != 0)
                {
                    Result = false;
                }
            }
            if (HUtil32.CompareLStr(QuestConditionInfo.sParam1, "WIZARD", 3))
            {
                if (PlayObject.m_btJob != 1)
                {
                    Result = false;
                }
            }
            if (HUtil32.CompareLStr(QuestConditionInfo.sParam1, "TAOIST", 3))
            {
                if (PlayObject.m_btJob != 2)
                {
                    Result = false;
                }
            }
        }

        /// <summary>
        /// 检查玩家等级
        /// </summary>
        /// <param name="PlayObject">玩家对象</param>
        /// <param name="QuestConditionInfo">脚本参数</param>
        /// <param name="Result">返回结果</param>
        private void ConditionOfCheckLevel(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            if (PlayObject.m_Abil.Level < QuestConditionInfo.nParam1)
            {
                Result = false;
            }
        }

        /// <summary>
        /// 检查玩家性别
        /// </summary>
        /// <param name="PlayObject">玩家对象</param>
        /// <param name="QuestConditionInfo">脚本参数</param>
        /// <param name="Result">返回结果</param>
        private void ConditionOfGender(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            if ((QuestConditionInfo.sParam2).ToLower().CompareTo(("HERO").ToLower()) == 0)// 增加检查英雄性别
            {
                if (PlayObject.m_MyHero != null)// sMAN
                {
                    if ((QuestConditionInfo.sParam1).ToLower().CompareTo(("MAN").ToLower()) == 0)
                    {
                        if (PlayObject.m_MyHero.m_btGender != 0)
                        {
                            Result = false;
                        }
                    }
                    else if ((QuestConditionInfo.sParam1).ToLower().CompareTo(("WOMAN").ToLower()) == 0)
                    {
                        if (PlayObject.m_MyHero.m_btGender != 1)
                        {
                            Result = false;
                        }
                    }
                }
                else
                {
                    Result = false;
                }
            }
            else
            {
                if ((QuestConditionInfo.sParam1).ToLower().CompareTo(("MAN").ToLower()) == 0)
                {
                    if (PlayObject.m_btGender != 0)
                    {
                        Result = false;
                    }
                }
                else
                {
                    if (PlayObject.m_btGender != 1)
                    {
                        Result = false;
                    }
                }
            }
        }

        private void ConditionOfDayTime(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            if ((QuestConditionInfo.sParam1).ToLower().CompareTo(("SUNRAISE").ToLower()) == 0)
            {
                if (M2Share.g_nGameTime != 0)
                {
                    Result = false;
                }
            }
            if ((QuestConditionInfo.sParam1).ToLower().CompareTo(("DAY").ToLower()) == 0)
            {
                if (M2Share.g_nGameTime != 1)
                {
                    Result = false;
                }
            }
            if ((QuestConditionInfo.sParam1).ToLower().CompareTo(("SUNSET").ToLower()) == 0)
            {
                if (M2Share.g_nGameTime != 2)
                {
                    Result = false;
                }
            }
            if ((QuestConditionInfo.sParam1).ToLower().CompareTo(("NIGHT").ToLower()) == 0)
            {
                if (M2Share.g_nGameTime != 3)
                {
                    Result = false;
                }
            }
        }

        protected void ConditionOfRandom(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            if (HUtil32.Random(QuestConditionInfo.nParam1) != 0)
            {
                Result = false;
            }
        }

        protected void ConditionOfCheckGold(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = true;
            var s01 = QuestConditionInfo.sParam1;
            var n14 = 0;
            if ((s01 != "") && (s01[0] == '<') && (s01[1] == '$'))
            {
                n14 = HUtil32.Str_ToInt(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam1), 0);
            }
            else if (!GetValValue(PlayObject, QuestConditionInfo.sParam1, ref n14))
            {
                n14 = QuestConditionInfo.nParam1;
            }
            if (PlayObject.m_nGold < n14)
            {
                Result = false;
            }
        }

        protected void ConditionOfCheck(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            int n14 = HUtil32.Str_ToInt(QuestConditionInfo.sParam1, 0);
            int n18 = HUtil32.Str_ToInt(QuestConditionInfo.sParam2, 0);
            int n10 = PlayObject.GetQuestFalgStatus(n14);
            if (n10 == 0)
            {
                if (n18 != 0)
                {
                    Result = false;
                }
            }
            else
            {
                if (n18 == 0)
                {
                    Result = false;
                }
            }
        }

        /// <summary>
        /// 检查玩家是否是新玩家
        /// </summary>
        private void ConditionOfISNewHuman(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            if (!PlayObject.m_boNewHuman)
            {
                Result = false;
            }
        }

        /// <summary>
        /// 检查人物名字在文件中的位置
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <param name="Result"></param>
        private void ConditionOfCheckNameListPostion(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            TStringList LoadList = null;
            string sCharName;
            int nNamePostion;
            int nPostion;
            string sLine;
            char cMethod;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                nNamePostion = -1;
                try
                {
                    sCharName = PlayObject.m_sCharName;
                    LoadList = new TStringList();
                    if (File.Exists(M2Share.g_Config.sEnvirDir + QuestConditionInfo.sParam1))
                    {
                        LoadList.LoadFromFile(M2Share.g_Config.sEnvirDir + QuestConditionInfo.sParam1);
                        if (LoadList.Count > 0)
                        {
                            for (int i = 0; i < LoadList.Count; i++)
                            {
                                sLine = LoadList[i].Trim();
                                if ((sLine == "") || (sLine[0] == ';'))
                                {
                                    continue;
                                }
                                if (string.Compare(sLine, sCharName, true) == 0)
                                {
                                    nNamePostion = i + 1;
                                    break;
                                }
                            }
                        }
                    }
                    else
                    {
                        ScriptConditionError(NormNpc, PlayObject, QuestConditionInfo, M2Share.sSC_CHECKNAMELISTPOSITION);
                    }
                }
                finally
                {
                    LoadList = null;
                }
                cMethod = QuestConditionInfo.sParam2[1];
                nPostion = HUtil32.Str_ToInt(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam3), -1);
                if (nPostion < 0)
                {
                    GetValValue(PlayObject, QuestConditionInfo.sParam3, ref nPostion);
                }
                SetValValue(PlayObject, QuestConditionInfo.sParam4, nNamePostion);
                if (nPostion < 0)
                {
                    ScriptConditionError(NormNpc, PlayObject, QuestConditionInfo, M2Share.sSC_CHECKNAMELISTPOSITION);
                    return;
                }
                switch (cMethod)
                {
                    case '=':
                        if (nNamePostion == nPostion)
                        {
                            Result = true;
                        }
                        break;
                    case '>':
                        if (nNamePostion > nPostion)
                        {
                            Result = true;
                        }
                        break;
                    case '<':
                        if (nNamePostion < nPostion)
                        {
                            Result = true;
                        }
                        break;
                    default:
                        if (nNamePostion >= nPostion)
                        {
                            Result = true;
                        }
                        break;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckNameListPostion");
            }
        }

        /// <summary>
        /// 检查行会是否在列表中
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <param name="Result"></param>
        private void ConditionOfCheckGuildList(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = true;
            if (PlayObject.m_MyGuild != null)
            {
                if (!GotoLable_CheckStringList(PlayObject.m_MyGuild.sGuildName, NormNpc.m_sPath + QuestConditionInfo.sParam1))
                {
                    Result = false;
                }
            }
            else
            {
                Result = false;
            }
        }

        /// <summary>
        /// 检查宝宝的名字
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <param name="Result"></param>
        private void ConditionOfCheckSlaveName(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            string sSlaveName = string.Empty;
            TBaseObject BaseObject;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                if (QuestConditionInfo.sParam1 == "")
                {
                    ScriptConditionError(NormNpc, PlayObject, QuestConditionInfo, M2Share.sSC_CHECKSLAVENAME);
                    return;
                }
                if (!GetValValue(PlayObject, QuestConditionInfo.sParam1, ref sSlaveName))
                {
                    sSlaveName = QuestConditionInfo.sParam1;
                }
                if (PlayObject.m_SlaveList.Count > 0)
                {
                    for (int i = 0; i < PlayObject.m_SlaveList.Count; i++)
                    {
                        BaseObject = PlayObject.m_SlaveList[i];
                        if ((sSlaveName).ToLower().CompareTo((BaseObject.m_sCharName).ToLower()) == 0)
                        {
                            Result = true;
                            break;
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckSlaveName");
            }
        }

        /// <summary>
        /// 检查人物身上指定物品位置是否佩带指定物品名称（为空则检查人物身上指定位置是否佩带物品）
        /// 格式:CHECKUSEITEM 物品位置(0-13) 物品名称
        /// </summary>
        /// <param name="Resul"></param>
        private void ConditionOfCheckUseItem(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            int nWhere;
            string sItmeName;
            TStdItem StdItem;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                nWhere = HUtil32.Str_ToInt(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam1), -1);
                sItmeName = GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam2);// 物品名称
                if (nWhere < 0)
                {
                    GetValValue(PlayObject, QuestConditionInfo.sParam1, ref nWhere);
                }
                if ((nWhere < 0) || (nWhere > PlayObject.m_UseItems.GetUpperBound(0)))
                {
                    ScriptConditionError(NormNpc,PlayObject, QuestConditionInfo, M2Share.sSC_CHECKUSEITEM);
                    return;
                }
                if (sItmeName != "")
                {
                    StdItem = M2Share.UserEngine.GetStdItem(PlayObject.m_UseItems[nWhere].wIndex);
                    if ((StdItem != null))
                    {
                        if ((StdItem.Name).ToLower().CompareTo((sItmeName).ToLower()) == 0)
                        {
                            Result = true;
                        }
                    }
                }
                else if (PlayObject.m_UseItems[nWhere].wIndex > 0)
                {
                    Result = true;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckUseItem");
            }
        }

        /// <summary>
        /// 检查人物经验
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <returns></returns>
        private void ConditionOfCheckExp(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            char cMethod;
            uint dwExp;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                dwExp = (uint)HUtil32.Str_ToInt(QuestConditionInfo.sParam2, 0);
                if (dwExp == 0)
                {
                    ScriptConditionError(NormNpc, PlayObject, QuestConditionInfo, M2Share.sSC_CHECKEXP);
                    return;
                }
                cMethod = QuestConditionInfo.sParam1[0];
                switch (cMethod)
                {
                    case '=':
                        if (PlayObject.m_Abil.Exp == dwExp)
                        {
                            Result = true;
                        }
                        break;
                    case '>':
                        if (PlayObject.m_Abil.Exp > dwExp)
                        {
                            Result = true;
                        }
                        break;
                    case '<':
                        if (PlayObject.m_Abil.Exp < dwExp)
                        {
                            Result = true;
                        }
                        break;
                    default:
                        if (PlayObject.m_Abil.Exp >= dwExp)
                        {
                            Result = true;
                        }
                        break;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckExp");
            }
        }

        /// <summary>
        /// 检测是否在同一地图范围内
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <returns></returns>
        private void ConditionOfCheckInMapRange(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            string sMapName;
            int nX;
            int nY;
            int nRange;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                sMapName = GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam1);
                nX = HUtil32.Str_ToInt(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam2), -1);
                nY = HUtil32.Str_ToInt(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam3), -1);
                nRange = HUtil32.Str_ToInt(GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam4), -1);
                if (nX < 0)
                {
                    GetValValue(PlayObject, QuestConditionInfo.sParam2, ref nX);// 增加变量支持
                }
                if (nY < 0)
                {
                    GetValValue(PlayObject, QuestConditionInfo.sParam3, ref nY);// 增加变量支持
                }
                if (nRange < 0)
                {
                    GetValValue(PlayObject, QuestConditionInfo.sParam4, ref nRange);// 增加变量支持
                }
                if ((sMapName == "") || (nX < 0) || (nY < 0) || (nRange < 0))
                {
                    ScriptConditionError(NormNpc, PlayObject, QuestConditionInfo, M2Share.sSC_CHECKINMAPRANGE);
                    return;
                }
                if ((PlayObject.m_sMapName).ToLower().CompareTo((sMapName).ToLower()) != 0)
                {
                    return;
                }
                if ((Math.Abs(PlayObject.m_nCurrX - nX) <= nRange) && (Math.Abs(PlayObject.m_nCurrY - nY) <= nRange))
                {
                    Result = true;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckInMapRange");
            }
        }

        /// <summary>
        /// 检查字符串是否在指定文件中
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <param name="Result"></param>
        private void ConditionOfCheckTextList(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            string s01 = QuestConditionInfo.sParam1;
            if ((s01 != "") && (s01[0] == '<') && (s01[1] == '$'))
            {
                s01 = GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam1);
            }
            else
            {
                GetValValue(PlayObject, QuestConditionInfo.sParam1, ref s01);
            }
            string s02 = GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam2);// 路径支持变量
            if (s02[0] == '\\')
            {
                s02 = s02.Substring(2 - 1, s02.Length - 1);
            }
            if (s02[1] == '\\')
            {
                s02 = s02.Substring(3 - 1, s02.Length - 2);
            }
            if (s02[2] == '\\')
            {
                s02 = s02.Substring(4 - 1, s02.Length - 3);
            }
            if (!GotoLable_CheckStringList(s01, s02))
            {
                Result = false;
            }
        }

        /// <summary>
        /// 检查当前玩家是否队伍队长
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <param name="Result"></param>
        private void ConditionOfIsGroupMaster(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            if (PlayObject.m_GroupOwner != null)
            {
                if (PlayObject.m_GroupOwner != PlayObject)
                {
                    Result = false;
                }
            }
            else
            {
                Result = false;
            }
        }

        /// <summary>
        /// 判断字符串包含在文件里
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <param name="Result"></param>
        private void ConditionOfCheCkContAinsTextList(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            string s01 = QuestConditionInfo.sParam1;
            string s02 = string.Empty;
            GetValValue(PlayObject, QuestConditionInfo.sParam1, ref s01);
            if (QuestConditionInfo.sParam2[0] == '\\')
            {
                s02 = QuestConditionInfo.sParam2.Substring(2 - 1, QuestConditionInfo.sParam2.Length - 1);
            }
            if (QuestConditionInfo.sParam2[1] == '\\')
            {
                s02 = QuestConditionInfo.sParam2.Substring(3 - 1, QuestConditionInfo.sParam2.Length - 2);
            }
            if (QuestConditionInfo.sParam2[2] == '\\')
            {
                s02 = QuestConditionInfo.sParam2.Substring(4 - 1, QuestConditionInfo.sParam2.Length - 3);
            }
            s02 = GetLineVariableText(NormNpc, PlayObject, s02);
            if (!GotoLable_CheckAnsiContainsTextList(s01, s02))
            {
                Result = false;
            }
        }

        private void ConditionOfCheCkTextList(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            string s01 = QuestConditionInfo.sParam2;
            string s02 = string.Empty;
            if ((s01 != "") && (s01[0] == '<') && (s01[1] == '$'))
            {
                s01 = GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam2);
            }
            else
            {
                GetValValue(PlayObject, QuestConditionInfo.sParam2, ref s01);
            }
            if (QuestConditionInfo.sParam1[0] == '\\')
            {
                s02 = QuestConditionInfo.sParam1.Substring(2 - 1, QuestConditionInfo.sParam1.Length - 1);
            }
            if (QuestConditionInfo.sParam1[0] == '\\')
            {
                s02 = QuestConditionInfo.sParam1.Substring(3 - 1, QuestConditionInfo.sParam1.Length - 2);
            }
            if (QuestConditionInfo.sParam1[2] == '\\')
            {
                s02 = QuestConditionInfo.sParam1.Substring(4 - 1, QuestConditionInfo.sParam1.Length - 3);
            }
            s02 = GetLineVariableText(NormNpc, PlayObject, s02);
            if (!GotoLable_CheckTextInList(s01, s02))
            {
                Result = false;
            }
        }

        /// <summary>
        /// 功能:检查文本里是否含有指定的字符串
        /// </summary>
        /// <param name="sTest"></param>
        /// <param name="sListFileName"></param>
        /// <returns></returns>
        public bool GotoLable_CheckTextInList(string sTest, string sListFileName)
        {
            bool result = false;
            TStringList LoadList;
            result = false;
            sListFileName = M2Share.g_Config.sEnvirDir + sListFileName;
            if (File.Exists(sListFileName))
            {
                LoadList = new TStringList();
                try
                {
                    LoadList.LoadFromFile(sListFileName);
                }
                catch
                {
                    M2Share.MainOutMessage("文件读取失败 => " + sListFileName);
                }
                if (LoadList.Count > 0)
                {
                    for (int i = 0; i < LoadList.Count; i++)
                    {
                        if ((LoadList[i].Trim().IndexOf(sTest) != -1))
                        {
                            result = true;
                            break;
                        }
                    }
                }
                LoadList = null;
            }
            else
            {
                M2Share.MainOutMessage("文件没有找到 => " + sListFileName);
            }
            return result;
        }

        public bool GotoLable_CheckAnsiContainsTextList(string sTest, string sListFileName)
        {
            bool Result = false;
            TStringList LoadList;
            sListFileName = M2Share.g_Config.sEnvirDir + sListFileName;
            if (File.Exists(sListFileName))
            {
                LoadList = new TStringList();
                try
                {
                    LoadList.LoadFromFile(sListFileName);
                }
                catch
                {
                    M2Share.MainOutMessage("loading fail.... => " + sListFileName);
                }
                for (int I = 0; I < LoadList.Count; I++)
                {
                    if ((sTest.IndexOf(LoadList[I].Trim()) != -1))
                    {
                        Result = true;
                        break;
                    }
                }
                LoadList = null;
            }
            else
            {
                M2Share.MainOutMessage("file not found => " + sListFileName);
            }
            return Result;
        }

        public bool GotoLable_CheckStringList(string sHumName, string sListFileName)
        {
            bool result = false;
            TStringList LoadList;
            sListFileName = M2Share.g_Config.sEnvirDir + sListFileName;
            if (File.Exists(sListFileName))
            {
                LoadList = new TStringList();
                try
                {
                    LoadList.LoadFromFile(sListFileName);
                }
                catch
                {
                    M2Share.MainOutMessage("文件读取失败 => " + sListFileName);
                }
                if (LoadList.Count > 0)
                {
                    for (int i = 0; i < LoadList.Count; i++)
                    {
                        if ((LoadList[i].Trim()).ToLower().CompareTo((sHumName).ToLower()) == 0)
                        {
                            result = true;
                            break;
                        }
                    }
                }
                LoadList = null;
            }
            else
            {
                M2Share.MainOutMessage("文件没有找到 => " + sListFileName);
            }
            return result;
        }


        /// <summary>
        /// 检查玩家是否在线
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <param name="Result"></param>
        private void ConditionOfCheckOnLine(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            //string s01 = QuestConditionInfo.sParam1;
            //if ((s01 != "") && (s01[0] == '<') && (s01[1] == '$'))
            //{
            //    s01 = GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam1);
            //}
            //else
            //{
            //    GetValValue(PlayObject, QuestConditionInfo.sParam1, ref s01);
            //}
            //if ((s01 == "") || (M2Share.UserEngine.GetPlayObject(s01) == null))
            //{
            //    Result = false;
            //}
        }

        /// <summary>
        /// 检查人物是否重叠
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <param name="Result"></param>
        private void ConditionOfIsDupMode(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            if (PlayObject.m_PEnvir != null)
            {
                if (PlayObject.m_PEnvir.GetXYObjCount(PlayObject.m_nCurrX, PlayObject.m_nCurrY) <= 1)
                {
                    Result = false;
                }
            }
            else
            {
                Result = false;
            }
        }

        /// <summary>
        /// 检查指定地图玩家数量
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <param name="Result"></param>
        private void ConditionOfCheckHum(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = true;
            int n14 = 0;
            if (!GetValValue(PlayObject, QuestConditionInfo.sParam2, ref n14))
            {
                n14 = QuestConditionInfo.nParam2;
            }
            if (M2Share.UserEngine.GetMapHuman(QuestConditionInfo.sParam1) < n14)
            {
                Result = false;
            }
        }

        private void ConditionOfCheckBagGage(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            if (PlayObject.IsEnoughBag())
            {
                string s01 = string.Empty;
                if (QuestConditionInfo.sParam1 != "")
                {
                    Result = false;
                    if (!GetValValue(PlayObject, QuestConditionInfo.sParam1, ref s01))
                    {
                        s01 = QuestConditionInfo.sParam1;
                    }
                    var StdItem = M2Share.UserEngine.GetStdItem(s01);
                    if (StdItem != null)
                    {
                        if (PlayObject.IsAddWeightAvailable(StdItem.Weight))
                        {
                            Result = true;
                        }
                    }
                }
            }
            else
            {
                Result = false;
            }
        }

        /// <summary>
        /// 检查玩家姓名是否存在指定文本中
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <param name="Result"></param>
        private void ConditionOfCheckNameList(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = true;
            if (!GotoLable_CheckStringList(PlayObject.m_sCharName, NormNpc.m_sPath + QuestConditionInfo.sParam1))
            {
                Result = false;
            }
        }

        /// <summary>
        /// 检查玩家帐号是否存在指定文本中
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <param name="Result"></param>
        private void ConditionOfCheckAccountList(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = true;
            if (!GotoLable_CheckStringList(PlayObject.m_sUserID, NormNpc.m_sPath + QuestConditionInfo.sParam1))
            {
                Result = false;
            }
        }

        /// <summary>
        /// 检查玩家IP是否存在指定文本中
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <param name="Result"></param>
        private void ConditionOfCheckIPList(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = true;
            if (!GotoLable_CheckStringList(PlayObject.m_sIPaddr, NormNpc.m_sPath + QuestConditionInfo.sParam1))
            {
                Result = false;
            }
        }

        /// <summary>
        /// 检查指定变量是否相等
        /// </summary>
        private void ConditionOfEqual(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            int n14 = 0;
            int n18 = 0;
            string s01 = string.Empty;
            string s02 = string.Empty;
            if (CheckVarNameNo(NormNpc, PlayObject, QuestConditionInfo, ref n14, ref n18))
            {
                if (n14 != n18)
                {
                    Result = false;
                }
                else
                {
                    Result = true;
                }
            }
            else
            {
                if (!GetValValue(PlayObject, QuestConditionInfo.sParam1, ref s01))
                {
                    s01 = GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam1);
                }
                if (!GetValValue(PlayObject, QuestConditionInfo.sParam2, ref s02))
                {
                    s02 = GetLineVariableText(NormNpc, PlayObject, QuestConditionInfo.sParam2);
                }
                if ((s01).ToLower().CompareTo((s02).ToLower()) == 0)
                {
                    Result = true;
                }
                else
                {
                    Result = false;
                }
            }
        }

        /// <summary>
        /// 功能:检查死的玩家(或杀死玩家)性别
        /// 格式:CHECKKILLPLAYSEX MAN/WOMAN
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <returns></returns>
        private void ConditionOfCheckPlaySex(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            string sParam1 = string.Empty;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                if (PlayObject.m_LastHiter != null)
                {
                    if (PlayObject.m_LastHiter.m_btRaceServer == Grobal2.RC_PLAYOBJECT)
                    {
                        sParam1 = GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam1);
                        switch (PlayObject.m_LastHiter.m_btGender)
                        {
                            case 0:
                                if ((sParam1).ToLower().CompareTo(("MAN").ToLower()) == 0)
                                {
                                    Result = true;
                                }
                                break;
                            case 1:
                                if ((sParam1).ToLower().CompareTo(("WOMAN").ToLower()) == 0)
                                {
                                    Result = true;
                                }
                                break;
                            default:
                                Result = false;
                                break;
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckPlaySex");
            }
        }

        /// <summary>
        /// 功能:检查死的玩家(或杀死玩家)职业
        /// 格式:CHECKPLAYDIEJOB WARRIOR/WIZARD/TAOIST/ASSASSIN
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <returns></returns>
        private void ConditionOfCheckPlayJob(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            string sParam1 = string.Empty;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                if (PlayObject.m_LastHiter != null)
                {
                    if (PlayObject.m_LastHiter.m_btRaceServer == Grobal2.RC_PLAYOBJECT)
                    {
                        sParam1 = GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam1);
                        switch (PlayObject.m_LastHiter.m_btJob)
                        {
                            case 0:
                                if ((sParam1).ToLower().CompareTo(("WARRIOR").ToLower()) == 0)
                                {
                                    Result = true;
                                }
                                break;
                            case 1:
                                if ((sParam1).ToLower().CompareTo(("WIZARD").ToLower()) == 0)
                                {
                                    Result = true;
                                }
                                break;
                            case 2:
                                if ((sParam1).ToLower().CompareTo(("TAOIST").ToLower()) == 0)
                                {
                                    Result = true;
                                }
                                break;
                            default:
                                Result = false;
                                break;
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckPlayJob");
            }
        }

        /// <summary>
        /// 功能:检查死的玩家(或杀死玩家)等级
        /// 格式:CHECKPLAYDIELVL 操作符(<,>,=) 等级
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <returns></returns>
        private void ConditionOfCheckPlaylvl(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            char cMethod;
            int nCount;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                nCount = HUtil32.Str_ToInt(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam2), 0);
                if (PlayObject.m_LastHiter != null)
                {
                    if (PlayObject.m_LastHiter.m_btRaceServer == Grobal2.RC_PLAYOBJECT)
                    {
                        cMethod = QuestConditionInfo.sParam1[0];
                        switch (cMethod) // 操作符
                        {
                            case '=':
                                if (PlayObject.m_LastHiter.m_WAbil.Level == nCount)
                                {
                                    Result = true;
                                }
                                break;
                            case '>':
                                if (PlayObject.m_LastHiter.m_WAbil.Level > nCount)
                                {
                                    Result = true;
                                }
                                break;
                            case '<':
                                if (PlayObject.m_LastHiter.m_WAbil.Level < nCount)
                                {
                                    Result = true;
                                }
                                break;
                            default:
                                if (PlayObject.m_LastHiter.m_WAbil.Level >= nCount)
                                {
                                    Result = true;
                                }
                                break;
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckPlaylvl");
            }
        }

        /// <summary>
        /// 检查占领沙巴克天数
        /// 格式：CASTLECHANGEDAY 空字符（>） (天数)7 
        /// </summary>
        private void ConditionOfCheckCastleChageDay(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            int nDay;
            char cMethod;
            int nChangeDay;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                nDay = HUtil32.Str_ToInt(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam2), -1);
                if (nDay < 0)
                {
                    GetValValue(PlayObject, QuestConditionInfo.sParam2, ref nDay);// 增加变量支持
                }
                if ((nDay < 0) || (NormNpc.m_Castle == null))
                {
                    ScriptConditionError(NormNpc,PlayObject, QuestConditionInfo, M2Share.sSC_CASTLECHANGEDAY);
                    return;
                }
                nChangeDay = HUtil32.GetDayCount(DateTime.Now, NormNpc.m_Castle.m_ChangeDate);
                cMethod = QuestConditionInfo.sParam1[0];
                switch (cMethod)
                {
                    case '=':
                        if (nChangeDay == nDay)
                        {
                            Result = true;
                        }
                        break;
                    case '>':
                        if (nChangeDay > nDay)
                        {
                            Result = true;
                        }
                        break;
                    case '<':
                        if (nChangeDay < nDay)
                        {
                            Result = true;
                        }
                        break;
                    default:
                        if (nChangeDay >= nDay)
                        {
                            Result = true;
                        }
                        break;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckCastleChageDay");
            }
        }

        /// <summary>
        /// 功能:检测指定人物是否在指定地图范围之内
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <returns></returns>
        private void ConditionOfCheckHumInRange(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            string sMapName;
            int nX;
            int nY;
            int nRange;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                if (!(QuestConditionInfo.sParam2 == "self"))// 不大明，可能有问题
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam1));
                }
                sMapName = GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam2);
                nX = HUtil32.Str_ToInt(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam3), -1);
                nY = HUtil32.Str_ToInt(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam4), -1);
                nRange = HUtil32.Str_ToInt(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam5), -1);
                if (nX < 0)
                {
                    GetValValue(PlayObject, QuestConditionInfo.sParam2, ref nX);// 增加变量支持
                }
                if (nY < 0)
                {
                    GetValValue(PlayObject, QuestConditionInfo.sParam3, ref nY);// 增加变量支持
                }
                if (nRange < 0)
                {
                    GetValValue(PlayObject, QuestConditionInfo.sParam4, ref nRange);// 增加变量支持
                }
                if ((sMapName == "") || (nX < 0) || (nY < 0) || (nRange < 0))
                {
                    ScriptConditionError(NormNpc,PlayObject, QuestConditionInfo, M2Share.sSC_CHECKINMAPRANGE);
                    return;
                }
                if ((PlayObject.m_sMapName).ToLower().CompareTo((sMapName).ToLower()) != 0)
                {
                    return;
                }
                if ((Math.Abs(PlayObject.m_nCurrX - nX) <= nRange) && (Math.Abs(PlayObject.m_nCurrY - nY) <= nRange))
                {
                    Result = true;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckInMapRange");
            }
        }

        /// <summary>
        /// 检查英雄的等级
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <returns></returns>
        private void ConditionOfCheckHeroLevel(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            int nHeroLevel;
            int nLevel;
            char cMethod;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                if (((!PlayObject.m_boHasHero) || (!PlayObject.m_boHasHeroTwo)) && (PlayObject.m_sHeroCharName == ""))
                {
                    ScriptConditionError(NormNpc,PlayObject, QuestConditionInfo, M2Share.sSC_CHECKHEROLEVEL);
                    return;
                }
                nLevel = HUtil32.Str_ToInt(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam2), -1);
                if (nLevel < 0)
                {
                    if (!GetValValue(PlayObject, QuestConditionInfo.sParam2, ref nLevel))
                    {
                        ScriptConditionError(NormNpc,PlayObject, QuestConditionInfo, M2Share.sSC_CHECKHEROLEVEL);
                        return;
                    }
                }
                if (PlayObject.m_MyHero != null)
                {
                    nHeroLevel = PlayObject.m_MyHero.m_Abil.Level;
                    cMethod = QuestConditionInfo.sParam1[0];
                    switch (cMethod)
                    {
                        case '=':
                            if (nHeroLevel == nLevel)
                            {
                                Result = true;
                            }
                            break;
                        case '>':
                            if (nHeroLevel > nLevel)
                            {
                                Result = true;
                            }
                            break;
                        case '<':
                            if (nHeroLevel < nLevel)
                            {
                                Result = true;
                            }
                            break;
                        default:
                            if (nHeroLevel >= nLevel)
                            {
                                Result = true;
                            }
                            break;
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckHeroLevel");
            }
        }

        /// <summary>
        /// 功能:检查在线人数
        /// 格式:CHECKONLINEPLAYCOUNT 操作符(<,>,=) 人数
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <returns></returns>
        private void ConditionOfCheckOnlinePlayCount(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            char cMethod;
            int nCount;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                nCount = HUtil32.Str_ToInt(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam2), -1);
                if ((nCount < 0))
                {
                    ScriptConditionError(NormNpc,PlayObject, QuestConditionInfo, M2Share.sSC_CHECKONLINEPLAYCOUNT);
                    return;
                }
                cMethod = QuestConditionInfo.sParam1[0];
                switch (cMethod) // 操作符
                {
                    case '=':
                        if (M2Share.UserEngine.PlayObjectCount == nCount)
                        {
                            Result = true;
                        }
                        break;
                    case '>':
                        if (M2Share.UserEngine.PlayObjectCount > nCount)
                        {
                            Result = true;
                        }
                        break;
                    case '<':
                        if (M2Share.UserEngine.PlayObjectCount < nCount)
                        {
                            Result = true;
                        }
                        break;
                    default:
                        if (M2Share.UserEngine.PlayObjectCount >= nCount)
                        {
                            Result = true;
                        }
                        break;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCHECKOnlinePlayCount");
            }
        }

        /// <summary>
        /// 功能:检查酒的品质 
        /// 格式:CHECKMAKEWINE 酒名称 操作符(<,>,=) 品质(0-10)
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <returns></returns>
        private void ConditionOfCheckMakeWine(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            string sItmeName;
            int nDura;
            TUserItem UserItem;
            TStdItem StdItem;
            char cMethod;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                sItmeName = GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam1);// 酒名称
                nDura = HUtil32.Str_ToInt(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam3), -1);// 酒品质
                if (nDura < 0)
                {
                    if (!GetValValue(PlayObject, QuestConditionInfo.sParam3, ref nDura))
                    {
                        ScriptConditionError(NormNpc,PlayObject, QuestConditionInfo, M2Share.sSC_CHECKMAKEWINE);
                        return;
                    }
                }
                if ((sItmeName == "") || (nDura < 0) || (nDura > 10))
                {
                    ScriptConditionError(NormNpc,PlayObject, QuestConditionInfo, M2Share.sSC_CHECKMAKEWINE);
                    return;
                }
                cMethod = QuestConditionInfo.sParam2[0];// 操作符
                if (PlayObject.m_ItemList.Count > 0)
                {
                    for (int i = 0; i < PlayObject.m_ItemList.Count; i++)
                    {
                        UserItem = (TUserItem)PlayObject.m_ItemList[i];
                        StdItem = M2Share.UserEngine.GetStdItem(UserItem.wIndex);
                        if ((StdItem != null) && (StdItem.StdMode == 60) && (StdItem.Shape != 0) && string.Compare(StdItem.Name, sItmeName, true) == 0)
                        {
                            switch (cMethod)
                            {
                                case '=':
                                    if (UserItem.btValue[0] == nDura)
                                    {
                                        Result = true;
                                    }
                                    break;
                                case '>':
                                    if (UserItem.btValue[0] > nDura)
                                    {
                                        Result = true;
                                    }
                                    break;
                                case '<':
                                    if (UserItem.btValue[0] < nDura)
                                    {
                                        Result = true;
                                    }
                                    break;
                                default:
                                    if (UserItem.btValue[0] >= nDura)
                                    {
                                        Result = true;
                                    }
                                    break;
                            }
                            if (Result)
                            {
                                break;
                            }
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCHECKMAKEWINE");
            }
        }

        /// <summary>
        /// 检测矿纯度
        /// 命令格式:CHECKMINE 矿名称 数量 纯度
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <returns></returns>
        private void ConditionOfCheckMine(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            string sMineName;
            int nMineCount;
            int nDura;
            int nCount;
            TUserItem UserItem;
            TStdItem StdItem;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                nCount = 0;
                sMineName = GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam1);// 矿石名
                nMineCount = HUtil32.Str_ToInt(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam2), -1);// 数量
                nDura = HUtil32.Str_ToInt(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam3), -1);// 纯度
                if (nMineCount < 0)
                {
                    if (!GetValValue(PlayObject, QuestConditionInfo.sParam2, ref nMineCount))
                    {
                        ScriptConditionError(NormNpc,PlayObject, QuestConditionInfo, M2Share.sSC_CHECKMINE);
                        return;
                    }
                }
                if (nDura < 0)
                {
                    if (!GetValValue(PlayObject, QuestConditionInfo.sParam3, ref nDura))
                    {
                        ScriptConditionError(NormNpc,PlayObject, QuestConditionInfo, M2Share.sSC_CHECKMINE);
                        return;
                    }
                }
                if ((sMineName == "") || (nMineCount < 0) || (nDura < 0) || (nDura > 100))
                {
                    ScriptConditionError(NormNpc,PlayObject, QuestConditionInfo, M2Share.sSC_CHECKMINE);
                    return;
                }
                if (PlayObject.m_ItemList.Count > 0)
                {
                    for (int i = 0; i < PlayObject.m_ItemList.Count; i++)
                    {
                        UserItem = (TUserItem)PlayObject.m_ItemList[i];
                        if (UserItem != null)
                        {
                            StdItem = M2Share.UserEngine.GetStdItem(UserItem.wIndex);
                            if ((StdItem != null))
                            {
                                if ((StdItem.StdMode == 43) && ((StdItem.Name).ToLower().CompareTo((sMineName).ToLower()) == 0))
                                {
                                    if (UserItem.Dura >= nDura * 1000)
                                    {
                                        nCount++;
                                    }
                                    if (nCount >= nMineCount)
                                    {
                                        Result = true;
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCHECKMINE");
            }
        }

        /// <summary>
        /// 功能：检查装备绑定状态 
        /// 格式：CHECKITEMSTATE 装备位置(0-13) 项目(0-5)
        /// 项目: 0 禁止扔1 禁止交易 2 禁止存 3 禁止修 4 禁止出售 5 禁止爆出
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <returns></returns>
        private void ConditionOfCheckItemState(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            int n1;
            int n2;
            TUserItem UserItem = null;
            TStdItem StdItem;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                n1 = HUtil32.Str_ToInt(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam1), -1);
                n2 = HUtil32.Str_ToInt(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam2), -1);
                if (n1 < 0)
                {
                    GetValValue(PlayObject, QuestConditionInfo.sParam1, ref n1);
                }
                if (n2 < 0)
                {
                    GetValValue(PlayObject, QuestConditionInfo.sParam2, ref n2);
                }
                if ((!(n1 >= 0 && n1 <= 13)) || (!(n2 >= 0 && n2 <= 5)))
                {
                    ScriptConditionError(NormNpc,PlayObject, QuestConditionInfo, M2Share.sCHECKITEMSTATE);
                    return;
                }
                UserItem = PlayObject.m_UseItems[n1];
                StdItem = M2Share.UserEngine.GetStdItem(UserItem.wIndex);
                if ((UserItem.wIndex <= 0) || (StdItem == null))
                {
                    // PlayObject.SysMsg('你身上没有戴指定物品！！！', c_Red, t_Hint);
                    return;
                }
                switch (n2)// 项目
                {
                    case 0:
                        if (UserItem.btValue[14] == 1)
                        {
                            Result = true;
                        }
                        break;
                    case 1:
                        if (UserItem.btValue[15] == 1)
                        {
                            Result = true;
                        }
                        break;
                    case 2:
                        if (UserItem.btValue[16] == 1)
                        {
                            Result = true;
                        }
                        break;
                    case 3:
                        if (UserItem.btValue[17] == 1)
                        {
                            Result = true;
                        }
                        break;
                    case 4:
                        if (UserItem.btValue[18] == 1)
                        {
                            Result = true;
                        }
                        break;
                    case 5:
                        if (UserItem.btValue[19] == 1)
                        {
                            Result = true;
                        }
                        break;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCHECKITEMSTATE");
            }
        }

        /// <summary>
        /// 检查英雄职业
        /// </summary>
        /// <returns></returns>
        private void ConditionOfCheckHeroJob(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            byte btJob;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                if (((!PlayObject.m_boHasHero) || (!PlayObject.m_boHasHeroTwo)) && (PlayObject.m_sHeroCharName == ""))
                {
                    ScriptConditionError(NormNpc,PlayObject, QuestConditionInfo, M2Share.sSC_CHECKHEROJOB);
                    return;
                }
                if (PlayObject.m_MyHero != null)
                {
                    btJob = PlayObject.m_MyHero.m_btJob;
                    if (HUtil32.CompareLStr(QuestConditionInfo.sParam1, "WARRIOR", 3))
                    {
                        Result = true;
                        if (btJob != 0)
                        {
                            Result = false;
                        }
                    }
                    if (HUtil32.CompareLStr(QuestConditionInfo.sParam1, "WIZARD", 3))
                    {
                        Result = true;
                        if (btJob != 1)
                        {
                            Result = false;
                        }
                    }
                    if (HUtil32.CompareLStr(QuestConditionInfo.sParam1, "TAOIST", 3))
                    {
                        Result = true;
                        if (btJob != 2)
                        {
                            Result = false;
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckHeroJob");
            }
        }

        /// <summary>
        /// 功能:检测当前日期是否小于大于等于指定的日期,检测后日期差存放在人物的M0中  
        /// 格式：CHECKCURRENTDATE ><= 日期
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <returns></returns>
        private void ConditionOfCHECKCURRENTDATE(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            char cMethod;// 操作符
            string sDate;// 指定的日期
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                sDate = QuestConditionInfo.sParam2;// 指定的日期
                cMethod = QuestConditionInfo.sParam1[0];
                switch (cMethod)
                {
                    case '=':
                        // 比较指定日期写当前日期
                        if (Convert.ToInt64(DateTime.Today) == Convert.ToInt64(Convert.ToDateTime(sDate)))
                        {
                            Result = true;
                        }
                        break;
                    case '>':
                        if (DateTime.Today > Convert.ToDateTime(sDate))
                        {
                            Result = true;
                        }
                        break;
                    case '<':
                        if (DateTime.Today < Convert.ToDateTime(sDate))
                        {
                            Result = true;
                        }
                        break;
                }
                if (DateTime.Today < Convert.ToDateTime(sDate))
                {
                    PlayObject.m_nMval[0] = Convert.ToInt32(DateTime.Today - Convert.ToDateTime(sDate));
                }
                else if (DateTime.Today > Convert.ToDateTime(sDate))
                {
                    // 负数
                    PlayObject.m_nMval[0] = -Convert.ToInt32(DateTime.Today - Convert.ToDateTime(sDate));
                }
                else if (Convert.ToInt64(DateTime.Today) == Convert.ToInt64(Convert.ToDateTime(sDate)))
                {
                    PlayObject.m_nMval[0] = 0;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCHECKCURRENTDATE");
            }
        }

        /// <summary>
        /// 检查是否在攻城期间
        /// 格式:CHECKCASTLEWAR 城堡名称
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <returns></returns>
        private void ConditionOfCHECKCASTLEWAR(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            TUserCastle Castle;
            string CastleName;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                CastleName = GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam1);// 城堡名称 支持变量
                Castle = M2Share.g_CastleManager.Find(CastleName);
                if (Castle != null)
                {
                    if (Castle.m_boUnderWar)
                    {
                        Result = true;
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCHECKCASTLEWAR");
            }
        }

        /// <summary>
        /// 检测师傅（或徒弟）是否在线
        /// 格式:CHECKMASTERONLINE
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <returns></returns>
        private void ConditionOfCHECKMASTERONLINE(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            TPlayObject m_MasterHuman;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                if (PlayObject.m_boMaster)// 有徒弟
                {
                    m_MasterHuman = M2Share.UserEngine.GetMasterObject(PlayObject.m_sCharName);
                    if (m_MasterHuman != null)
                    {
                        Result = true;
                    }
                }
                else if (PlayObject.m_sMasterName != "")
                {
                    m_MasterHuman = M2Share.UserEngine.GetPlayObject(PlayObject.m_sMasterName);
                    if (m_MasterHuman != null)
                    {
                        Result = true;
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCHECKMASTERONLINE");
            }
        }

        /// <summary>
        /// 检测夫妻一方是否在线
        /// 格式:CHECKDEARONLINE
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <returns></returns>
        private void ConditionOfCHECKDEARONLINE(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                if (PlayObject.m_DearHuman != null)
                {
                    Result = true;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCHECKDEARONLINE");
            }
        }

        /// <summary>
        /// 检测师傅(或徒弟)是否在XXX地图,支持SELF(是否同一地图) 
        /// 格式:CHECKMASTERONMAP XXX
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <returns></returns>
        private void ConditionOfCHECKMASTERONMAP(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            TPlayObject m_MasterHuman;
            string sMapName;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                if ((QuestConditionInfo.sParam1).ToLower().CompareTo(("Self").ToLower()) == 0)
                {
                    sMapName = PlayObject.m_sMapName;
                }
                else
                {
                    sMapName = QuestConditionInfo.sParam1;
                    GetValValue(PlayObject, QuestConditionInfo.sParam1, ref sMapName);
                }
                if (PlayObject.m_boMaster)// 有徒弟
                {
                    m_MasterHuman = M2Share.UserEngine.GetMasterObject(PlayObject.m_sCharName);
                    if ((m_MasterHuman != null) && ((m_MasterHuman.m_sMapName).ToLower().CompareTo((sMapName).ToLower()) == 0))
                    {
                        Result = true;
                    }
                }
                else if (PlayObject.m_sMasterName != "")
                {
                    m_MasterHuman = M2Share.UserEngine.GetPlayObject(PlayObject.m_sMasterName);
                    if ((m_MasterHuman != null) && ((m_MasterHuman.m_sMapName).ToLower().CompareTo((sMapName).ToLower()) == 0))
                    {
                        Result = true;
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCHECKMASTERONMAP");
            }
        }

        /// <summary>
        /// 检测夫妻一方是否在XXX地图,支持SELF(是否同一地图)
        /// 格式:CHECKDEARONMAP XXX
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <returns></returns>
        private void ConditionOfCHECKDEARONMAP(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            string sMapName;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                if ((QuestConditionInfo.sParam1).ToLower().CompareTo(("Self").ToLower()) == 0)
                {
                    sMapName = PlayObject.m_sMapName;
                }
                else
                {
                    sMapName = QuestConditionInfo.sParam1;
                    GetValValue(PlayObject, QuestConditionInfo.sParam1, ref sMapName);
                }
                if ((PlayObject.m_DearHuman != null) && ((PlayObject.m_DearHuman.m_sMapName).ToLower().CompareTo((sMapName).ToLower()) == 0))
                {
                    Result = true;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCHECKDEARONMAP");
            }
        }

        /// <summary>
        /// 检测对面是否为自己的徒弟
        /// 格式:CHECKPOSEISPRENTICE
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <returns></returns>
        private void ConditionOfCHECKPOSEISPRENTICE(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            TBaseObject BaseObject;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                BaseObject = PlayObject.GetPoseCreate();// 判断面对面是否有人物
                if (BaseObject != null)
                {
                    if (((TPlayObject)(BaseObject)).m_boMaster)  // 有徒弟
                    {
                        if ((((TPlayObject)(BaseObject)).m_sMasterName).ToLower().CompareTo((PlayObject.m_sCharName).ToLower()) == 0)
                        {
                            Result = true;
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCHECKPOSEISPRENTICE");
            }
        }

        /// <summary>
        /// 脚本命令 FINDMAPPATH 地图 起步X 起步Y 终点X 终点Y (只要使用一次既可)
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <returns></returns>
        private void ConditionOfFINDMAPPATH(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            string sMap;
            int nX;
            int nY;
            int nXX;
            int nYY;
            Envirnoment Envir;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                sMap = GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam1);// 地图支持变量
                nX = HUtil32.Str_ToInt(QuestConditionInfo.sParam2, -1);// 起步X
                nY = HUtil32.Str_ToInt(QuestConditionInfo.sParam3, -1);// 起步Y
                nXX = HUtil32.Str_ToInt(QuestConditionInfo.sParam4, -1);// 终点X
                nYY = HUtil32.Str_ToInt(QuestConditionInfo.sParam5, -1);// 终点Y
                if (sMap == "")
                {
                    return;
                }
                Envir = M2Share.g_MapManager.FindMap(sMap);// 查找地图
                if (Envir != null)
                {
                    M2Share.UserEngine.m_nCurrX_136 = nX;
                    M2Share.UserEngine.m_nCurrY_136 = nY;
                    M2Share.UserEngine.m_NewCurrX_136 = nXX;
                    M2Share.UserEngine.m_NewCurrY_136 = nYY;
                    PlayObject.m_sMapName136 = sMap;// 魔王岭地图名称
                    Result = true;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfFINDMAPPATH");
            }
        }

        /// <summary>
        /// 检测英雄的忠诚度
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <returns></returns>
        private void ConditionOfCHECKHEROLOYAL(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            char cMethod;
            int nLoyal;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                if (PlayObject.m_MyHero == null)
                {
                    return;
                }
                nLoyal = HUtil32.Str_ToInt(QuestConditionInfo.sParam2, -1);
                if (nLoyal < 0)
                {
                    if (!GetValValue(PlayObject, QuestConditionInfo.sParam2, ref nLoyal))
                    {
                        ScriptConditionError(NormNpc,PlayObject, QuestConditionInfo, M2Share.sSC_CHECKHEROLOYAL);
                        return;
                    }
                }
                cMethod = QuestConditionInfo.sParam1[1];
                switch (cMethod)
                {
                    case '=':
                        if (((THeroObject)(PlayObject.m_MyHero)).m_nLoyal == nLoyal)
                        {
                            Result = true;
                        }
                        break;
                    case '>':
                        if (((THeroObject)(PlayObject.m_MyHero)).m_nLoyal > nLoyal)
                        {
                            Result = true;
                        }
                        break;
                    case '<':
                        if (((THeroObject)(PlayObject.m_MyHero)).m_nLoyal < nLoyal)
                        {
                            Result = true;
                        }
                        break;
                    default:
                        if (((THeroObject)(PlayObject.m_MyHero)).m_nLoyal >= nLoyal)
                        {
                            Result = true;
                        }
                        break;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCHECKHEROLOYAL");
            }
        }

        /// <summary>
        /// 判断是否在酿哪种酒
        /// 格式:ISONMAKEWINE X(1,2)  X-1普通酒 2-药酒
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <returns></returns>
        private void ConditionOfISONMAKEWINE(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            byte nMakeWineType;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                nMakeWineType = (byte)HUtil32.Str_ToInt(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam1), 0);
                if (!new ArrayList(new byte[] { 1, 2 }).Contains(nMakeWineType))
                {
                    ScriptConditionError(NormNpc,PlayObject, QuestConditionInfo, M2Share.sISONMAKEWINE);
                    return;
                }
                if (PlayObject.m_boMakeWine)// 在NPC处正在酿酒
                {
                    if (PlayObject.n_MakeWineType == nMakeWineType)
                    {
                        Result = true; // 酒的类型一致
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfISONMAKEWINE");
            }
        }

        /// <summary>
        /// 功能:判断是否开启行会泉水仓库
        /// 格式:CHECKGUILDFOUNTAIN
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <returns></returns>
        private void ConditionOfCHECKGUILDFOUNTAIN(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                if (PlayObject.m_MyGuild != null)
                {
                    if (PlayObject.m_MyGuild.boGuildFountainOpen)
                    {
                        Result = true;
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCHECKGUILDFOUNTAIN");
            }
        }

        /// <summary>
        ///  功能:检测当前地图中的人物是否属于同一个行会(所有人是同一行会才为真)
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <returns></returns>
        private void ConditionOfMAPHUMISSAMEGUILD(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            string sMapName;
            string Guildname;
            TGUild Guild;
            TPlayObject sPlayObject;
            List<TPlayObject> Playobjectlist;
            try
            {
                Result = true;
                sMapName = QuestConditionInfo.sParam1.Trim();
                Guildname = QuestConditionInfo.sParam2.Trim();
                if (Guildname == "")
                {
                    Guild = PlayObject.m_MyGuild;
                    Guildname = Guild.sGuildName;
                }
                Playobjectlist = new List<TPlayObject>();
                M2Share.UserEngine.GetMapRageHuman(M2Share.g_MapManager.FindMap(sMapName), 1000, 1000, 1000, Playobjectlist);
                for (int i = 0; i < Playobjectlist.Count; i++)
                {
                    sPlayObject = Playobjectlist[i];
                    Guild = sPlayObject.m_MyGuild;
                    if (!((Guildname).ToLower().CompareTo((Guild.sGuildName).ToLower()) == 0))
                    {
                        Result = false;
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfMAPHUMISSAMEGUILD");
            }
        }

        /// <summary>
        /// 检查人物身上物品的附加属性值
        /// 检查物品增加的附属属性
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <returns></returns>
        private void ConditionOfCheckItemAddValue(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            int nWhere;
            int nAddAllValue;
            int nAddValue;
            TUserItem UserItem;
            char cMethod;
            int nValType;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                nWhere = HUtil32.Str_ToInt(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam1), -1);
                if (nWhere < 0)
                {
                    GetValValue(PlayObject, QuestConditionInfo.sParam1, ref nWhere);
                }
                nValType = HUtil32.Str_ToInt(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam2), -1);
                if (nValType < 0)
                {
                    GetValValue(PlayObject, QuestConditionInfo.sParam2, ref nValType);
                }
                nAddValue = HUtil32.Str_ToInt(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam4), -1);
                if (nAddValue < 0)
                {
                    GetValValue(PlayObject, QuestConditionInfo.sParam4, ref nAddValue);
                }
                cMethod = QuestConditionInfo.sParam3[1];
                if ((nValType < 0) || (nValType > 15) || (nWhere < 0) || (nWhere > PlayObject.m_UseItems.GetUpperBound(0)) || (nAddValue < 0))
                {
                    ScriptConditionError(NormNpc,PlayObject, QuestConditionInfo, M2Share.sSC_CHECKITEMADDVALUE);
                    return;
                }
                UserItem = PlayObject.m_UseItems[nWhere];
                if (UserItem.wIndex == 0)
                {
                    return;
                }
                if (nValType == 15)// 15代表吸伤属性
                {
                    nValType = 20;
                }
                if (nValType == 14)
                {
                    nAddAllValue = UserItem.DuraMax;
                }
                else
                {
                    nAddAllValue = UserItem.btValue[nValType];
                }
                switch (cMethod)
                {
                    case '=':
                        if (nAddAllValue == nAddValue)
                        {
                            Result = true;
                        }
                        break;
                    case '>':
                        if (nAddAllValue > nAddValue)
                        {
                            Result = true;
                        }
                        break;
                    case '<':
                        if (nAddAllValue < nAddValue)
                        {
                            Result = true;
                        }
                        break;
                    default:
                        if (nAddAllValue >= nAddValue)
                        {
                            Result = true;
                        }
                        break;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckItemAddValue");
            }
        }

        private void ConditionOfCheckNameIPList(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            TStringList LoadList = null;
            string sCharName;
            string sCharAccount;
            string sCharIPaddr;
            string sLine;
            string sName = string.Empty;
            string sIPaddr;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                try
                {
                    sCharName = PlayObject.m_sCharName;
                    sCharAccount = PlayObject.m_sUserID;
                    sCharIPaddr = PlayObject.m_sIPaddr;
                    LoadList = new TStringList();
                    if (File.Exists(M2Share.g_Config.sEnvirDir + QuestConditionInfo.sParam1))
                    {
                        LoadList.LoadFromFile(M2Share.g_Config.sEnvirDir + QuestConditionInfo.sParam1);
                        if (LoadList.Count > 0)
                        {
                            for (int i = 0; i < LoadList.Count; i++)
                            {
                                sLine = LoadList[i];
                                if (sLine[0] == ';')
                                {
                                    continue;
                                }
                                sIPaddr = HUtil32.GetValidStr3(sLine, ref sName, new string[] { " ", "/", "\09" });
                                sIPaddr = sIPaddr.Trim();
                                if ((sName == sCharName) && (sIPaddr == sCharIPaddr))
                                {
                                    Result = true;
                                    break;
                                }
                            }
                        }
                    }
                    else
                    {
                        ScriptConditionError(NormNpc,PlayObject, QuestConditionInfo, M2Share.sSC_CHECKNAMEIPLIST);
                    }
                }
                finally
                {
                    LoadList = null;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckNameIPList");
            }
        }

        /// <summary>
        /// 检查人物技能
        /// 功能：检查英雄技能
        /// HEROCHECKSKILL 技能名称 控制符(=,>,<)  修炼等级
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <returns></returns>
        private void ConditionOfHEROCHECKSKILL(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            int nSkillLevel;
            char cMethod;
            TUserMagic UserMagic;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                nSkillLevel = HUtil32.Str_ToInt(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam3), -1);
                if (nSkillLevel < 0)
                {
                    if (!GetValValue(PlayObject, QuestConditionInfo.sParam3, ref nSkillLevel))
                    {
                        ScriptConditionError(NormNpc,PlayObject, QuestConditionInfo, M2Share.sHEROCHECKSKILL);
                        return;
                    }
                }
                if (((!PlayObject.m_boHasHero) || (!PlayObject.m_boHasHeroTwo)) && (PlayObject.m_sHeroCharName == ""))
                {
                    ScriptConditionError(NormNpc,PlayObject, QuestConditionInfo, M2Share.sHEROCHECKSKILL);
                    return;
                }
                if (PlayObject.m_MyHero != null)
                {
                    UserMagic = null;
                    UserMagic = ((TPlayObject)(PlayObject.m_MyHero)).GetMagicInfo(QuestConditionInfo.sParam1);
                    if (UserMagic == null)
                    {
                        return;
                    }
                    cMethod = QuestConditionInfo.sParam2[0];
                    switch (cMethod)
                    {
                        case '=':
                            if (UserMagic.btLevel == nSkillLevel)
                            {
                                Result = true;
                            }
                            break;
                        case '>':
                            if (UserMagic.btLevel > nSkillLevel)
                            {
                                Result = true;
                            }
                            break;
                        case '<':
                            if (UserMagic.btLevel < nSkillLevel)
                            {
                                Result = true;
                            }
                            break;
                        default:
                            if (UserMagic.btLevel >= nSkillLevel)
                            {
                                Result = true;
                            }
                            break;
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfHEROCHECKSKILL");
            }
        }

        /// <summary>
        /// 判断是否有英雄
        /// 格式:HAVEHERO TRUE 带TRUE参数代码,判断是否有卧龙英雄,不带表示判断是否有白日门英雄
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <returns></returns>
        private void ConditionOfCheckHasHero(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                if ((QuestConditionInfo.sParam1).ToLower().CompareTo(("TRUE").ToLower()) == 0)// 是否有卧龙英雄
                {
                    if (PlayObject.m_boHasHeroTwo && (PlayObject.m_sHeroCharName != ""))
                    {
                        Result = true;
                    }
                }
                else
                {
                    if (PlayObject.m_boHasHero && (PlayObject.m_sHeroCharName != ""))// 是否有白日门英雄
                    {
                        Result = true;
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckHasHero");
            }
        }

        /// <summary>
        /// 检查英雄是否在线
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <returns></returns>
        private void ConditionOfCheckHeroOnline(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = PlayObject.m_MyHero != null;
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCheckHeroOnline");
            }
        }

        /// <summary>
        /// 功能:检测英雄PK值
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <returns></returns>
        private void ConditionOfCHECKHEROPKPOINT(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            int n_mHEROPKPOINT;
            int nHEROPKPOINT;
            char cMethod;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                if (((!PlayObject.m_boHasHero) || (!PlayObject.m_boHasHeroTwo)) && (PlayObject.m_sHeroCharName == ""))
                {
                    ScriptConditionError(NormNpc,PlayObject, QuestConditionInfo, M2Share.sSC_CHECKHEROPKPOINT);
                    return;
                }
                nHEROPKPOINT = HUtil32.Str_ToInt(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam2), -1);
                if (nHEROPKPOINT < 0)
                {
                    if (!GetValValue(PlayObject, QuestConditionInfo.sParam2, ref nHEROPKPOINT))
                    {
                        ScriptConditionError(NormNpc,PlayObject, QuestConditionInfo, M2Share.sSC_CHECKHEROPKPOINT);
                        return;
                    }
                }
                if (PlayObject.m_MyHero != null)
                {
                    n_mHEROPKPOINT = PlayObject.m_MyHero.m_nPkPoint;
                    cMethod = QuestConditionInfo.sParam1[0];
                    switch (cMethod)
                    {
                        case '=':
                            if (n_mHEROPKPOINT == nHEROPKPOINT)
                            {
                                Result = true;
                            }
                            break;
                        case '>':
                            if (n_mHEROPKPOINT > nHEROPKPOINT)
                            {
                                Result = true;
                            }
                            break;
                        case '<':
                            if (n_mHEROPKPOINT < nHEROPKPOINT)
                            {
                                Result = true;
                            }
                            break;
                        default:
                            if (n_mHEROPKPOINT >= nHEROPKPOINT)
                            {
                                Result = true;
                            }
                            break;
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCHECKHEROPKPOINT");
            }
        }

        /// <summary>
        /// 功能：检测文本里的编码是否存在
        /// 格式：CHECKCODELIST 玩家变量 文件路径
        /// 例子: CHECKCODELIST <$STR(S1)> ..\questdiary\冲值\500元卡号.txt
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <returns></returns>
        private void ConditionOfCHECKCODELIST(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            TStringList LoadList = null;
            string sPlayID;
            string sLine;
            string sFileName;
            try
            {
                Result = false;
                try
                {
                    sPlayID = GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam1);// 用户的变量,即输入的字符
                    LoadList = new TStringList();
                    sFileName = QuestConditionInfo.sParam2;// 文本路径
                    if (sFileName[0] == '\\')
                    {
                        sFileName = sFileName.Substring(2 - 1, sFileName.Length - 1);
                    }
                    if (sFileName[1] == '\\')
                    {
                        sFileName = sFileName.Substring(3 - 1, sFileName.Length - 2);
                    }
                    if (sFileName[2] == '\\')
                    {
                        sFileName = sFileName.Substring(4 - 1, sFileName.Length - 3);
                    }
                    sFileName = M2Share.g_Config.sEnvirDir + sFileName;
                    if (File.Exists(sFileName))
                    {

                        LoadList.LoadFromFile(sFileName);
                        if (LoadList.Count > 0)
                        {
                            for (int i = 0; i < LoadList.Count; i++)
                            {
                                sLine = LoadList[i].Trim();
                                if ((sLine == "") || (sLine[0] == ';'))
                                {
                                    continue;
                                }
                                if ((sLine).ToLower().CompareTo((sPlayID).ToLower()) == 0)
                                {
                                    Result = true;
                                    break;
                                }
                            }
                        }
                    }
                    else
                    {
                        ScriptConditionError(NormNpc,PlayObject, QuestConditionInfo, M2Share.sSC_CHECKCODELIST);
                    }
                }
                finally
                {
                    LoadList = null;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCHECKCODELIST");
            }
        }

        /// <summary>
        /// 功能：检测行会成员上限
        /// 格式：CHECKGUILDMEMBERCOUNT <,>,= 人数(65535)
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <returns></returns>
        private void ConditionOfCHECKGUILDMEMBERCOUNT(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            ushort nMemberCount;
            char cMethod;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                if (PlayObject.m_MyGuild != null)
                {
                    nMemberCount = (ushort)HUtil32.Str_ToInt(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam2), 0);
                    cMethod = QuestConditionInfo.sParam1[0];
                    switch (cMethod)
                    {
                        case '=':
                            if (PlayObject.m_MyGuild.GuildMemberCount == nMemberCount)
                            {
                                Result = true;
                            }
                            break;
                        case '>':
                            if (PlayObject.m_MyGuild.GuildMemberCount > nMemberCount)
                            {
                                Result = true;
                            }
                            break;
                        case '<':
                            if (PlayObject.m_MyGuild.GuildMemberCount < nMemberCount)
                            {
                                Result = true;
                            }
                            break;
                        default:
                            if (PlayObject.m_MyGuild.GuildMemberCount >= nMemberCount)
                            {
                                Result = true;
                            }
                            break;
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCHECKGUILDMEMBERCOUNT");
            }
        }

        /// <summary>
        /// 功能：检测行会酒泉数
        /// 格式：CHECKGUILDFOUNTAINVALUE <,>,= 点数
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <returns></returns>
        private void ConditionOfCHECKGUILDFOUNTAINValue(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            int nPoint;
            char cMethod;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                if (PlayObject.m_MyGuild != null)
                {
                    nPoint = HUtil32.Str_ToInt(QuestConditionInfo.sParam2, 0);
                    cMethod = QuestConditionInfo.sParam1[0];
                    switch (cMethod)
                    {
                        case '=':
                            if (PlayObject.m_MyGuild.m_nGuildFountain == nPoint)
                            {
                                Result = true;
                            }
                            break;
                        case '>':
                            if (PlayObject.m_MyGuild.m_nGuildFountain > nPoint)
                            {
                                Result = true;
                            }
                            break;
                        case '<':
                            if (PlayObject.m_MyGuild.m_nGuildFountain < nPoint)
                            {
                                Result = true;
                            }
                            break;
                        default:
                            if (PlayObject.m_MyGuild.m_nGuildFountain >= nPoint)
                            {
                                Result = true;
                            }
                            break;
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCHECKGUILDFOUNTAINValue");
            }
        }

        /// <summary>
        /// 功能:检查角色内功等级
        /// 格式:CHECKNGLEVEL 操作符(<,>,=) 等级数(1-255) Hero
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <returns></returns>
        private void ConditionOfCHECKNGLEVEL(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            byte nLevel;
            char cMethod;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                nLevel = (byte)HUtil32.Str_ToInt(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam2), 0);
                if ((nLevel <= 0) || (nLevel > 255))
                {
                    ScriptConditionError(NormNpc,PlayObject, QuestConditionInfo, M2Share.sCHECKNGLEVEL);
                    return;
                }
                cMethod = QuestConditionInfo.sParam1[0];
                if ((QuestConditionInfo.sParam3).ToLower().CompareTo(("HERO").ToLower()) == 0)
                {
                    if (PlayObject.m_MyHero != null)
                    {
                        if (((THeroObject)(PlayObject.m_MyHero)).m_boTrainingNG)
                        {
                            switch (cMethod)
                            {
                                case '=':
                                    if (((THeroObject)(PlayObject.m_MyHero)).m_NGLevel == nLevel)
                                    {
                                        Result = true;
                                    }
                                    break;
                                case '>':
                                    if (((THeroObject)(PlayObject.m_MyHero)).m_NGLevel > nLevel)
                                    {
                                        Result = true;
                                    }
                                    break;
                                case '<':
                                    if (((THeroObject)(PlayObject.m_MyHero)).m_NGLevel < nLevel)
                                    {
                                        Result = true;
                                    }
                                    break;
                                default:
                                    if (((THeroObject)(PlayObject.m_MyHero)).m_NGLevel >= nLevel)
                                    {
                                        Result = true;
                                    }
                                    break;
                            }
                        }
                    }
                }
                else
                {
                    if (PlayObject.m_boTrainingNG)
                    {
                        switch (cMethod)
                        {
                            case '=':
                                if (PlayObject.m_NGLevel == nLevel)
                                {
                                    Result = true;
                                }
                                break;
                            case '>':
                                if (PlayObject.m_NGLevel > nLevel)
                                {
                                    Result = true;
                                }
                                break;
                            case '<':
                                if (PlayObject.m_NGLevel < nLevel)
                                {
                                    Result = true;
                                }
                                break;
                            default:
                                if (PlayObject.m_NGLevel >= nLevel)
                                {
                                    Result = true;
                                }
                                break;
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCHECKNGLEVEL");
            }
        }

        /// <summary>
        /// 功能:检查指定装备位置是否带有指定的物品
        /// 格式:CHECKITEMSNAME 位置(0-13) 物品名称
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <returns></returns>
        private void ConditionOfCHECKITEMSNAME(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            int n1;
            string sName = string.Empty;
            TUserItem UserItem;
            TStdItem StdItem;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                n1 = HUtil32.Str_ToInt(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam1), -1);// 位置
                sName = GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam2);// 物品名字
                if ((!(n1 >= 0 && n1 <= 13)) || (sName == ""))
                {
                    ScriptConditionError(NormNpc,PlayObject, QuestConditionInfo, M2Share.sCHECKITEMSNAME);
                    return;
                }
                UserItem = PlayObject.m_UseItems[n1];
                StdItem = M2Share.UserEngine.GetStdItem(UserItem.wIndex);
                if ((UserItem.wIndex <= 0) || (StdItem == null))
                {
                    //PlayObject.SysMsg('你身上没有戴指定物品！！！', c_Red, t_Hint);
                    return;
                }
                if (string.Compare(StdItem.Name, sName, true) == 0)
                {
                    Result = true;
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCHECKITEMSNAME");
            }
        }

        /// <summary>
        /// 功能：检测服务器最高属性人物命令  
        /// 格式：ISHIGH 项目(L P D M S)
        /// 项目: L--等级  P--PK值  D--攻击力  M--魔法力  S--道术
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <returns></returns>
        private void ConditionOfISHIGH(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            string str;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                str = GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam1);
                if ((str == "") || (str.Length > 2))
                {
                    ScriptConditionError(NormNpc,PlayObject, QuestConditionInfo, M2Share.sISHIGH);
                    return;
                }
                if (PlayObject.m_btPermission < 6)// 人物权限小于6
                {
                    if ((str).ToLower().CompareTo(("L").ToLower()) == 0)// 检查等级
                    {
                        if (M2Share.g_HighLevelHuman != null)
                        {
                            if (PlayObject.m_Abil.Level > ((TPlayObject)(M2Share.g_HighLevelHuman)).m_Abil.Level)
                            {
                                Result = true;
                            }
                        }
                        else
                        {
                            Result = true;
                        }
                    }
                    else if ((str).ToLower().CompareTo(("P").ToLower()) == 0)// 检查PK值
                    {
                        if (M2Share.g_HighPKPointHuman != null)
                        {
                            if (PlayObject.m_nPkPoint > ((TPlayObject)(M2Share.g_HighPKPointHuman)).m_nPkPoint)
                            {
                                Result = true;
                            }
                        }
                        else
                        {
                            Result = true;
                        }
                    }
                    else if ((str).ToLower().CompareTo(("D").ToLower()) == 0) // 检查攻击力
                    {
                        if (M2Share.g_HighDCHuman != null)
                        {
                            if (HUtil32.HiWord(PlayObject.m_WAbil.DC) > HUtil32.HiWord(((TPlayObject)(M2Share.g_HighDCHuman)).m_WAbil.DC))
                            {
                                Result = true;
                            }
                        }
                        else
                        {
                            Result = true;
                        }
                    }
                    else if ((str).ToLower().CompareTo(("M").ToLower()) == 0) // 检查魔法力
                    {
                        if (M2Share.g_HighMCHuman != null)
                        {
                            if (HUtil32.HiWord(PlayObject.m_WAbil.MC) > HUtil32.HiWord(((TPlayObject)(M2Share.g_HighMCHuman)).m_WAbil.MC))
                            {
                                Result = true;
                            }
                        }
                        else
                        {
                            Result = true;
                        }
                    }
                    else if ((str).ToLower().CompareTo(("S").ToLower()) == 0) // 检查道术
                    {
                        if (M2Share.g_HighSCHuman != null)
                        {
                            if (HUtil32.HiWord(PlayObject.m_WAbil.SC) > HUtil32.HiWord(((TPlayObject)(M2Share.g_HighSCHuman)).m_WAbil.SC))
                            {
                                Result = true;
                            }
                        }
                        else
                        {
                            Result = true;
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfISHIGH");
            }
        }

        /// <summary>
        /// 功能:检查角色是否学过内功 
        /// 格式:CHANGREADNG Hero
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="QuestConditionInfo"></param>
        /// <returns></returns>
        private void ConditionOfCHANGREADNG(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result)
        {
            Result = false;
            try
            {
                if (QuestConditionInfo.sParam6 == "88")
                {
                    PlayObject = M2Share.UserEngine.GetPlayObject(GetLineVariableText(NormNpc,PlayObject, QuestConditionInfo.sParam7));
                    if (PlayObject == null)
                    {
                        return;
                    }
                }
                Result = false;
                if ((QuestConditionInfo.sParam1).ToLower().CompareTo(("HERO").ToLower()) == 0)
                {
                    if (PlayObject.m_MyHero != null)
                    {
                        if (((THeroObject)(PlayObject.m_MyHero)).m_boTrainingNG)
                        {
                            Result = true;
                        }
                    }
                }
                else
                {
                    if (PlayObject.m_boTrainingNG)
                    {
                        Result = true;
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.ConditionOfCHANGREADNG");
            }
        }

        private void ScriptConditionError(TNormNpc NormNpc, TPlayObject PlayObject,  TQuestConditionInfo QuestConditionInfo, string sCmd)
        {
            string sMsg = "Cmd:" + sCmd + " NPC名称:" + NormNpc.m_sCharName + " 地图:" + NormNpc.m_sMapName + " 座标:" + NormNpc.m_nCurrX + ':' + NormNpc.m_nCurrY + " 参数1:"
                  + QuestConditionInfo.sParam1 + " 参数2:" + QuestConditionInfo.sParam2 + " 参数3:" + QuestConditionInfo.sParam3 + " 参数4:" + QuestConditionInfo.sParam4 + " 参数5:"
                  + QuestConditionInfo.sParam5;
            M2Share.MainOutMessage("[脚本参数不正确] " + sMsg);
        }
    }
}